Metadata-Version: 2.4
Name: FruitSalad
Version: 0.2.1
Summary: A fruit salad project
Author: FruitSalad Contributors
License-Expression: MIT
Project-URL: Homepage, https://github.com/your-username/FruitSalad
Project-URL: Repository, https://github.com/your-username/FruitSalad
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: blake3
Requires-Dist: pyyaml
Dynamic: license-file

# FruitSalad

A Python toolkit for working with structured config file formats — `.cucumber`/`.ccb` for human-readable configs with BLAKE3 integrity, and `.melon`/`.mel` for compact binary serialization. Includes a VS Code extension with syntax highlighting, snippets, and file icons.

## Installation

```bash
pip install fruitsalad
```

Requires Python 3.10+.

## File Formats

### Cucumber (`.cucumber` / `.ccb`)

Human-readable config format with key-value pairs organized in sections:

```cucumber
--h-- Auto-Generated by FruitSalad --h--
--h-- BLAKE3: <hash> --h--

server
    host | localhost
    port | 8080

database
    driver | sqlite
    file   | data.db
```

**Line format:** `key | value` with optional type annotations (`:int`, `:bool`, `:str`).

### Melon (`.melon` / `.mel`)

Binary serialization format using TLV (Type-Length-Value) encoding with BLAKE3 checksums. Compact and fast — ideal for size-sensitive storage.

## CLI Usage

### Generate files

```bash
# Generate an empty file
fruitsalad gef example.cucumber

# Protected (enforce integrity on load)
fruitsalad gef -P secret.cucumber

# Generate in .ccb / .melon / .mel
fruitsalad gef config.ccb
```

### Prepare for production

```bash
# Normalize extensions and reseal
fruitsalad to-production .

# Reseal only (skip .ccb -> .cucumber rename)
fruitsalad to-production . -N

# Mark as protected
fruitsalad to-production . -P

# Recursive
fruitsalad to-production ./cfg -R
```

### Convert between formats

```bash
fruitsalad convert input.cucumber output.json
fruitsalad to-json input.cucumber
fruitsalad to-yaml input.cucumber > output.yaml
fruitsalad to-cucumber input.json
fruitsalad to-melon input.cucumber
```

### VS Code integration

```bash
# Install extension (uses bundled VSIX — no npm required)
fruitsalad vscode

# Rebuild from source before installing (requires npm)
fruitsalad vscode --build
```

## Python API

```python
from fruitsalad import load, save, reseal, test_file, gef

# Load a .cucumber file
data = load("config.cucumber")
print(data)
# {'server': {'host': 'localhost', 'port': 8080}}

# Save data
save("output.cucumber", data)
save("output.cucumber", data, protected=True)

# Re-seal after manual edits
reseal("config.cucumber")

# Generate files
gef("empty.cucumber")
gef("empty.cucumber", protected=True)

# Test file generation
test_file("test.cucumber")
```

### Working with Melon

```python
from fruitsalad import MelonSerializer

m = MelonSerializer()
data = m.load("data.melon")
m.save("data.melon", data)
```

## Protected Mode

Files created with `-P` / `protected=True` include a `PROTECTED` header in cucumber files or a protection flag in melon files. When loading a protected file:

- **Hash matches** → loads normally
- **Hash mismatches** → raises `ValueError` (tampering detected)

Unprotected files load normally regardless of hash — the hash is used for caching only, and resealing always updates it.

## VS Code Extension

The VS Code extension provides:

- **Syntax highlighting** for `.cucumber` / `.ccb` and `.melon` / `.mel` files
- **Snippets** — `header`, `section`, `kv` for quick editing
- **Hover info** — shows key/value pairs and BLAKE3 hashes on hover
- **Commands** — Verify hash, Reseal, Generate empty file, Convert to JSON/YAML
- **File icons** — Material Icon Theme integration included

Install with:

```bash
fruitsalad vscode --build
```

Then run **Developer: Reload Window** in VS Code.

## Development

```bash
git clone <repo>
cd FruitSalad
python -m venv .venv
.venv\Scripts\activate    # Windows
source .venv/bin/activate  # macOS/Linux
pip install -e .
```

## License

MIT
