feat(v1.4.1): add native proposal module, Lover Accept Checker AI, and modules documentation catalog
This commit is contained in:
1 parent
4895c201c1
commit
b7ae6c9725
20 files changed
+600
-34
No files matched your search
@@ -0,0 +1,37 @@
|
||||
# 📦 AiraLang Standard Library Modules Directory
|
||||
> **Official Module Catalog for AiraLang (v1.4.1 Aira Cyber & AI Edition)**
|
||||
> **Author & Creator:** Adam Eehan (Founder & CEO, Aira Group of Technology) 👑
|
||||
|
||||
---
|
||||
|
||||
## 🌟 Overview
|
||||
AiraLang features 14 built-in standard library modules engineered natively for speed, AI capabilities, cyber security recon, system operations, and developer joy.
|
||||
|
||||
All modules are loaded natively via the `import` statement:
|
||||
```aira
|
||||
import "<module_name>";
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📋 Complete Modules Catalog
|
||||
|
||||
| # | Module | Category | Primary Purpose | Key Methods |
|
||||
|---|---|---|---|---|
|
||||
| 1 | [`ai`](./ai.md) | Artificial Intelligence | Multi-provider LLM engine (Groq & Gemini auto-routing) | `ask()`, `chat()`, `summarize()`, `set_key()`, `set_system()` |
|
||||
| 2 | [`proposal`](./proposal.md) | Fun & Cyber-Prank | Automated HTTP 500 love timeout & AI sentiment checker | `ask()`, `set_key()`, `set_system()`, `wish()`, `set_wish()` |
|
||||
| 3 | [`sec`](./sec.md) | Cybersecurity | Port scanning, header auditing, subdomain discovery | `scan_ports()`, `audit_headers()`, `subdomains()`, `crack_md5()` |
|
||||
| 4 | [`http`](./http.md) | Networking | Web requests, REST APIs, and file downloads | `get()`, `post()`, `download()`, `status()` |
|
||||
| 5 | [`file`](./file.md) | System I/O | Read, write, append, and inspect local files | `read()`, `write()`, `append()`, `exists()`, `delete()` |
|
||||
| 6 | [`os`](./os.md) | System | Shell commands, environment variables, directories | `cmd()`, `env()`, `cwd()`, `listdir()`, `mkdir()`, `platform()` |
|
||||
| 7 | [`math`](./math.md) | Mathematics | Math functions, trigonometry, and constants | `sqrt()`, `pow()`, `abs()`, `random()`, `round()`, `pi`, `e` |
|
||||
| 8 | [`time`](./time.md) | System | Epoch time, timestamps, and execution delays | `now()`, `time()`, `sleep()` |
|
||||
| 9 | [`json`](./json.md) | Data | Parsing and serialization of JSON payloads | `parse()`, `stringify()`, `mkstring()` |
|
||||
| 10 | [`crypto`](./crypto.md) | Security | Cryptographic hashes and encoding utilities | `md5()`, `sha256()`, `sha1()`, `base64_encode()`, `base64_decode()` |
|
||||
| 11 | [`string`](./string.md) | Utilities | Advanced text manipulation and transformation | `split()`, `replace()`, `upper()`, `lower()`, `trim()`, `join()` |
|
||||
| 12 | [`sqlite`](./sqlite.md) | Database | Lightweight embedded SQL relational database | `open()`, `query()`, `execute()`, `close()` |
|
||||
| 13 | [`net`](./net.md) | Networking | Host pings, TCP port checks, and IP discovery | `ping()`, `port_open()`, `local_ip()`, `fetch()` |
|
||||
| 14 | [`thread`](./thread.md) | Concurrency | Thread spawning, worker pools, and parallel execution | `spawn()`, `join()`, `pool()`, `sleep()` |
|
||||
|
||||
---
|
||||
*Maintained by the AiraLang Core Engineering Team. Created by Adam Eehan.*
|
||||
@@ -0,0 +1,26 @@
|
||||
# 🤖 AiraLang `ai` Module
|
||||
> **Generative AI & LLM Integration Engine**
|
||||
> Native dual-provider AI supporting both Google Gemini and Groq LLMs with automatic key-prefix routing and custom system prompts.
|
||||
|
||||
## Import
|
||||
```aira
|
||||
import "ai";
|
||||
```
|
||||
|
||||
## Methods
|
||||
- `ai.set_key(api_key, [provider])`: Configure API key. Keys starting with `gsk_` automatically select Groq; others select Gemini.
|
||||
- `ai.get_key([provider])`: Retrieve configured API key.
|
||||
- `ai.set_system(prompt)`: Customize the AI engine system prompt/persona (default: official Aira persona).
|
||||
- `ai.ask(prompt, [model], [key], [system])`: Send a prompt and get the AI model response.
|
||||
- `ai.groq(prompt, [model], [key], [system])`: Direct execution on Groq cloud inference.
|
||||
- `ai.summarize(text, [max_words])`: Summarize text within specified word count.
|
||||
- `ai.chat(messages, [model], [key])`: Multi-turn conversational chat.
|
||||
|
||||
## Example
|
||||
```aira
|
||||
import "ai";
|
||||
|
||||
ai.set_key("gsk_YOUR_GROQ_KEY");
|
||||
let ans = ai.ask("What is AiraLang?");
|
||||
say ans;
|
||||
```
|
||||
@@ -0,0 +1,21 @@
|
||||
# 🔐 AiraLang `crypto` Module
|
||||
> **Cryptographic Hashing & Encoding**
|
||||
|
||||
## Import
|
||||
```aira
|
||||
import "crypto";
|
||||
```
|
||||
|
||||
## Methods
|
||||
- `crypto.md5(text)`: Generate MD5 hex digest.
|
||||
- `crypto.sha256(text)`: Generate SHA-256 hex digest.
|
||||
- `crypto.sha1(text)`: Generate SHA-1 hex digest.
|
||||
- `crypto.base64_encode(text)`: Base64 encoding.
|
||||
- `crypto.base64_decode(encoded)`: Base64 decoding.
|
||||
|
||||
## Example
|
||||
```aira
|
||||
import "crypto";
|
||||
|
||||
say "Hash: " + crypto.sha256("admin123");
|
||||
```
|
||||
@@ -0,0 +1,24 @@
|
||||
# 📁 AiraLang `file` Module
|
||||
> **Local File System I/O Operations**
|
||||
|
||||
## Import
|
||||
```aira
|
||||
import "file";
|
||||
```
|
||||
|
||||
## Methods
|
||||
- `file.read(path)`: Read entire text file.
|
||||
- `file.write(path, content)`: Overwrite file with content.
|
||||
- `file.append(path, content)`: Append content to file.
|
||||
- `file.exists(path)`: Check if file exists.
|
||||
- `file.delete(path)`: Remove file.
|
||||
- `file.size(path)`: Get file size in bytes.
|
||||
|
||||
## Example
|
||||
```aira
|
||||
import "file";
|
||||
|
||||
file.write("test.txt", "AiraLang v1.4.1");
|
||||
let text = file.read("test.txt");
|
||||
say text;
|
||||
```
|
||||
@@ -0,0 +1,21 @@
|
||||
# 🌐 AiraLang `http` Module
|
||||
> **HTTP Networking & Web Request Client**
|
||||
|
||||
## Import
|
||||
```aira
|
||||
import "http";
|
||||
```
|
||||
|
||||
## Methods
|
||||
- `http.get(url, [headers])`: Perform HTTP GET request.
|
||||
- `http.post(url, data_payload, [headers])`: Perform HTTP POST request.
|
||||
- `http.download(url, destination_path)`: Download remote file to local disk.
|
||||
- `http.status(url)`: Get HTTP response status code.
|
||||
|
||||
## Example
|
||||
```aira
|
||||
import "http";
|
||||
|
||||
let html = http.get("https://httpbin.org/get");
|
||||
say html;
|
||||
```
|
||||
@@ -0,0 +1,19 @@
|
||||
# 📋 AiraLang `json` Module
|
||||
> **JSON Parsing & Serialization**
|
||||
|
||||
## Import
|
||||
```aira
|
||||
import "json";
|
||||
```
|
||||
|
||||
## Methods
|
||||
- `json.parse(json_string)`: Parse JSON string into AiraLang dictionary or list.
|
||||
- `json.stringify(obj, [indent=2])` / `json.mkstring()`: Serialize data structure to JSON.
|
||||
|
||||
## Example
|
||||
```aira
|
||||
import "json";
|
||||
|
||||
let obj = json.parse("{"status": "ok", "code": 200}");
|
||||
say obj["status"];
|
||||
```
|
||||
@@ -0,0 +1,24 @@
|
||||
# 📐 AiraLang `math` Module
|
||||
> **Mathematical Functions & Constants**
|
||||
|
||||
## Import
|
||||
```aira
|
||||
import "math";
|
||||
```
|
||||
|
||||
## Methods & Constants
|
||||
- `math.sqrt(x)`: Square root.
|
||||
- `math.floor(x)`, `math.ceil(x)`: Rounding down and up.
|
||||
- `math.abs(x)`: Absolute value.
|
||||
- `math.round(x, [decimals])`: Rounding.
|
||||
- `math.pow(base, exp)`: Exponentiation.
|
||||
- `math.random(low, high)`: Generate random integer or float.
|
||||
- `math.pi`: $\pi$ constant (~3.14159265).
|
||||
- `math.e`: Euler constant (~2.7182818).
|
||||
|
||||
## Example
|
||||
```aira
|
||||
import "math";
|
||||
|
||||
say "Hypotenuse: " + math.sqrt(math.pow(3, 2) + math.pow(4, 2)); # 5.0
|
||||
```
|
||||
@@ -0,0 +1,21 @@
|
||||
# 📡 AiraLang `net` Module
|
||||
> **Low-Level Network Diagnostics & Sockets**
|
||||
|
||||
## Import
|
||||
```aira
|
||||
import "net";
|
||||
```
|
||||
|
||||
## Methods
|
||||
- `net.ping(host, [timeout=2])`: Check ICMP reachability.
|
||||
- `net.port_open(host, port, [timeout=2])`: Test TCP socket connectivity.
|
||||
- `net.local_ip()`: Retrieve current local network IP address.
|
||||
- `net.fetch(url)`: Quick HTTP GET shortcut.
|
||||
|
||||
## Example
|
||||
```aira
|
||||
import "net";
|
||||
|
||||
say "Local IP: " + net.local_ip();
|
||||
say "Gateway reachable: " + net.ping("1.1.1.1");
|
||||
```
|
||||
@@ -0,0 +1,23 @@
|
||||
# 💻 AiraLang `os` Module
|
||||
> **Operating System Interaction & Shell Commands**
|
||||
|
||||
## Import
|
||||
```aira
|
||||
import "os";
|
||||
```
|
||||
|
||||
## Methods
|
||||
- `os.cmd(command)` / `os.system(command)`: Execute shell command and return stdout.
|
||||
- `os.env(name, [default])`: Read environment variable.
|
||||
- `os.platform()`: Return host OS platform (linux, darwin, win32).
|
||||
- `os.cwd()`: Current working directory.
|
||||
- `os.listdir([path])`: List files and directories.
|
||||
- `os.mkdir(path)`: Create directory recursively.
|
||||
|
||||
## Example
|
||||
```aira
|
||||
import "os";
|
||||
|
||||
say "OS: " + os.platform();
|
||||
say "Files: ", os.listdir(".");
|
||||
```
|
||||
@@ -0,0 +1,27 @@
|
||||
# 💖 AiraLang `proposal` Module
|
||||
> **Cyber-Romance & Proposal Prank Engine**
|
||||
> Features an automated HTTP 500 Server Love Timeout loop and an intelligent Lover Accept Checker AI with celebratory wishes.
|
||||
|
||||
## Import
|
||||
```aira
|
||||
import "proposal";
|
||||
import "ai"; # Optional, for shared API key configuration
|
||||
```
|
||||
|
||||
## Methods
|
||||
- `proposal.ask(prompt="Do You Love Me : ", [api_key], [wish_enabled=True])`: Runs proposal prompt. Automatically enters an inescapable simulated HTTP 500 error loop until target answers affirmatively.
|
||||
- `proposal.set_key(api_key)`: Sets Groq or Gemini API key for Lover Accept Checker AI sentiment analysis.
|
||||
- `proposal.set_system(system_prompt)`: Customizes Lover Accept Checker AI persona.
|
||||
- `proposal.set_wish(custom_wish)`: Sets a custom congratulatory message.
|
||||
- `proposal.wish([custom_message])`: Triggers Aira celebratory wish immediately.
|
||||
|
||||
## Example
|
||||
```aira
|
||||
import "proposal";
|
||||
import "ai";
|
||||
|
||||
ai.set_key("gsk_YOUR_GROQ_KEY");
|
||||
|
||||
proposal.ask("Do You Love Me : ");
|
||||
say "mee too 🩷";
|
||||
```
|
||||
@@ -0,0 +1,27 @@
|
||||
# 🛡️ AiraLang `sec` Module
|
||||
> **Cybersecurity & Ethical Reconnaissance Engine**
|
||||
> Built natively for security researchers, penetration testers, and cyber defenders.
|
||||
|
||||
## Import
|
||||
```aira
|
||||
import "sec";
|
||||
```
|
||||
|
||||
## Methods
|
||||
- `sec.scan_ports(host, ports, [timeout])`: Multi-threaded TCP port scanner.
|
||||
- `sec.scan_port(host, port, [timeout])`: Single port check.
|
||||
- `sec.banner(host, port, [timeout])`: Grab service banner.
|
||||
- `sec.audit_headers(url)`: Security header audit (CSP, HSTS, X-Frame-Options) with grading.
|
||||
- `sec.subdomains(domain)`: Discover subdomains via Certificate Transparency.
|
||||
- `sec.hash_identify(hash_string)`: Identify hash algorithms (MD5, SHA1, SHA256, Bcrypt, etc.).
|
||||
- `sec.crack_md5(hash, wordlist)`: Dictionary-based MD5 cracker.
|
||||
- `sec.resolve(hostname)`: DNS host-to-IP resolution.
|
||||
- `sec.reverse_dns(ip)`: Reverse DNS lookup.
|
||||
|
||||
## Example
|
||||
```aira
|
||||
import "sec";
|
||||
|
||||
let open_ports = sec.scan_ports("google.com", [80, 443, 8080]);
|
||||
say "Open Ports: ", open_ports;
|
||||
```
|
||||
@@ -0,0 +1,25 @@
|
||||
# 🗄️ AiraLang `sqlite` Module
|
||||
> **Embedded Relational SQL Database**
|
||||
|
||||
## Import
|
||||
```aira
|
||||
import "sqlite";
|
||||
```
|
||||
|
||||
## Methods
|
||||
- `sqlite.open(path)`: Open or create database file.
|
||||
- `sqlite.execute(db, sql, [params])`: Execute DDL/DML statements (INSERT, UPDATE, DELETE).
|
||||
- `sqlite.query(db, sql, [params])`: Execute SELECT and return rows as dictionary list.
|
||||
- `sqlite.close(db)`: Close database connection.
|
||||
|
||||
## Example
|
||||
```aira
|
||||
import "sqlite";
|
||||
|
||||
let db = sqlite.open("test.db");
|
||||
sqlite.execute(db, "CREATE TABLE IF NOT EXISTS logs (msg TEXT);");
|
||||
sqlite.execute(db, "INSERT INTO logs VALUES (?);", ["System Booted"]);
|
||||
let rows = sqlite.query(db, "SELECT * FROM logs;");
|
||||
say rows;
|
||||
sqlite.close(db);
|
||||
```
|
||||
@@ -0,0 +1,26 @@
|
||||
# 🔤 AiraLang `string` Module
|
||||
> **Advanced Text & String Utilities**
|
||||
|
||||
## Import
|
||||
```aira
|
||||
import "string";
|
||||
```
|
||||
|
||||
## Methods
|
||||
- `string.split(text, [delimiter])`: Split text into array.
|
||||
- `string.replace(text, old, new)`: Replace occurrences.
|
||||
- `string.upper(text)`: Convert to uppercase.
|
||||
- `string.lower(text)`: Convert to lowercase.
|
||||
- `string.trim(text)`: Strip whitespace.
|
||||
- `string.length(text)`: Get length.
|
||||
- `string.contains(text, sub)`: Check substring presence.
|
||||
- `string.starts_with(text, prefix)`: Check prefix.
|
||||
- `string.ends_with(text, suffix)`: Check suffix.
|
||||
- `string.join(list, [sep])`: Join list into string.
|
||||
|
||||
## Example
|
||||
```aira
|
||||
import "string";
|
||||
|
||||
say string.upper("hello world");
|
||||
```
|
||||
@@ -0,0 +1,25 @@
|
||||
# 🧵 AiraLang `thread` Module
|
||||
> **Concurrency, Worker Pools & Multithreading**
|
||||
|
||||
## Import
|
||||
```aira
|
||||
import "thread";
|
||||
```
|
||||
|
||||
## Methods
|
||||
- `thread.spawn(fn, [args])`: Launch function in background thread.
|
||||
- `thread.join(thread_handle, [timeout])`: Wait for thread completion.
|
||||
- `thread.sleep(seconds)`: Thread sleep delay.
|
||||
- `thread.pool(fn, items, [max_workers=5])`: Parallel execution over collection.
|
||||
|
||||
## Example
|
||||
```aira
|
||||
import "thread";
|
||||
|
||||
fn task(id) {
|
||||
return "Task " + id + " done";
|
||||
}
|
||||
|
||||
let res = thread.pool(task, [1, 2, 3, 4], 4);
|
||||
say res;
|
||||
```
|
||||
@@ -0,0 +1,21 @@
|
||||
# ⏱️ AiraLang `time` Module
|
||||
> **Time, Clock & Sleep Utilities**
|
||||
|
||||
## Import
|
||||
```aira
|
||||
import "time";
|
||||
```
|
||||
|
||||
## Methods
|
||||
- `time.now()`: Formatted current timestamp (`YYYY-MM-DD HH:MM:SS`).
|
||||
- `time.time()`: Unix epoch timestamp in seconds.
|
||||
- `time.sleep(seconds)`: Pause thread execution.
|
||||
|
||||
## Example
|
||||
```aira
|
||||
import "time";
|
||||
|
||||
say "Start: " + time.now();
|
||||
time.sleep(1);
|
||||
say "End: " + time.now();
|
||||
```
|
||||
Reference in new issue
Block a user