Metadata-Version: 2.4
Name: BLDEV
Version: 0.2.0
Summary: CLI and library for Bloret Launcher API and plugin development
Home-page: https://github.com/BloretCrew/Bloret-Launcher-API-Tool
Author: Detritalww
Author-email: Detritalww <Detritalw@outlook.com>
License: MIT
Project-URL: Homepage, https://github.com/BloretCrew/Bloret-Launcher-API-Tool
Project-URL: Bug Tracker, https://github.com/BloretCrew/Bloret-Launcher-API-Tool/issues
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.25.0
Provides-Extra: dev
Requires-Dist: pytest>=6.0; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: flake8; extra == "dev"
Dynamic: author
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

# BLDEV (Bloret Launcher Developer CLI)

CLI and Python library for Bloret Launcher API access and plugin development.

Install the package as **BLDEV**, run the command as **`BLDEV`**, and continue importing the Python package as `BLAPI` for compatibility.

`BLCLI` and `BLAPI` remain available as command aliases.

## Installation

```bash
pip install BLDEV
```

Or install from source:

```bash
pip install .
```

## Usage

### As a Library

```python
from BLAPI import Client, request_api, LauncherClient

# Using the Client class
client = Client(base_url="https://api.bloret.com", token="your-token")
response = client.request("GET", "/v1/games")

# Using the convenience function
response = request_api("GET", "/v1/games", token="your-token")
```

### As a Command-Line Tool

After installation, use the `BLDEV` command:

```bash
# Make a GET request
BLDEV get /v1/games

# Make a POST request with data
BLDEV post /v1/games --data '{"name": "New Game"}'

# Specify a custom base URL and token
BLDEV --base-url https://api.bloret.com --token your-token get /v1/games

# Save output to a file
BLDEV get /v1/games --output games.json
```

Compatibility aliases:

```bash
BLCLI --help
BLAPI --help
```

## Commands

- `get` - Make a GET request to an endpoint
- `post` - Make a POST request to an endpoint
- `put` - Make a PUT request to an endpoint
- `delete` - Make a DELETE request to an endpoint
- `plugin` - Scaffold, validate, inspect, build, install, and develop launcher plugins

## Plugin Development

BLDEV includes an offline plugin SDK and CLI for Bloret Launcher plugins.

```bash
# Create a plugin project
BLDEV plugin init my-plugin --id com.example.my-plugin --template python --non-interactive

# Validate the project (offline)
BLDEV plugin validate my-plugin --strict

# Inspect normalized manifest and high-risk permissions
BLDEV plugin inspect my-plugin

# Build a reproducible ZIP with plugin.json at the archive root
BLDEV plugin build my-plugin -o dist

# Install into the local Bloret Launcher data directory
BLDEV plugin install my-plugin
# or:
BLDEV plugin install my-plugin --data-dir /path/to/Bloret-Launcher-data --force

# Validate, install, and query a running launcher (OAuth only needed for runtime status)
BLDEV plugin dev my-plugin --oauth-name YOUR_APP --oauth-secret YOUR_SECRET
```

Supported templates:

- `python` - Python extension plugin with `register(api)`
- `declarative` / `theme` - theme-only declarative plugin
- `nav` - QML navigation page plugin
- `agent` - Bloriko Agent tool/prompt starter

As a library:

```python
from BLAPI.plugin import (
    scaffold_plugin,
    validate_project,
    inspect_project,
    build_plugin,
    install_plugin,
    find_launcher_data_dir,
)
from BLAPI import LauncherClient

project = scaffold_plugin("my-plugin", "com.example.my-plugin", template="python")
diagnostics = validate_project(project)
archive = build_plugin(project, "dist/my-plugin.zip")
install_plugin(project, find_launcher_data_dir() / "Plugin", force=True)

client = LauncherClient(
    "http://localhost:25252",
    oauth_name="YOUR_APP",
    oauth_secret="YOUR_SECRET",
)
print(client.plugin_info("com.example.my-plugin"))
```

Notes:

- `plugin init/validate/inspect/build/install` are offline and do not require OAuth setup.
- Python plugins run in-process with the launcher; permissions are capability checks, not a sandbox.
- ZIP archives must place `plugin.json` at the root (BLDEV `plugin build` does this automatically).

## Options

- `--base-url` - Base URL for the API (default: https://api.bloret.com)
- `--token` - Authorization token for API requests
- `--output`, `-o` - Output file (default: stdout)

## Development

To install the package in development mode:

```bash
pip install -e .
```

To run tests:

```bash
pytest
```

## License

MIT
