Metadata-Version: 2.4
Name: lr-lumenlabel-cli
Version: 3.0.2
Summary: CLI for the LumenRadio LumenLabel label printing station: import label packages fetched from Arena with gladiator, list labels and inspect the station, locally, on the LAN or through the Fleet relay.
Author-email: Jonas Estberger <jonas.estberger@lumenradio.com>
License-Expression: MIT
Project-URL: Homepage, https://gitlab.com/lumenradio/production/lumenlabel
Project-URL: Changelog, https://gitlab.com/lumenradio/production/lumenlabel/-/blob/main/CHANGELOG.md
Keywords: LumenRadio,LumenLabel,label printing,Arena,CLI
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Classifier: Environment :: Console
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typer>=0.12
Requires-Dist: rich>=13.7
Requires-Dist: httpx>=0.27
Requires-Dist: lr-fleet>=0.7
Provides-Extra: dev
Requires-Dist: build>=1.2.1; extra == "dev"
Requires-Dist: twine>=6.1; extra == "dev"
Requires-Dist: pytest>=8.4; extra == "dev"
Requires-Dist: pytest-cov>=5.0; extra == "dev"
Requires-Dist: black>=25.9; extra == "dev"
Requires-Dist: setuptools_scm>=8; extra == "dev"
Provides-Extra: package
Requires-Dist: pyinstaller==6.21.0; extra == "package"
Dynamic: license-file

# lr-lumenlabel-cli

The `lumenlabel` command for LumenRadio LumenLabel label printing stations.
It turns a label fetched from Arena with gladiator into a label package and
imports it into a station, locally, on the LAN or through the Fleet relay.

## Installation

```bash
pip install lr-lumenlabel-cli
```

The LumenLabel installers also put it on every station: the `.msi` as
`lumenlabel.exe` on the system `PATH`, the `.deb` as `/usr/bin/lumenlabel`.
There it imports from a USB stick without a network (airgapped mode).

## Quick start

```bash
# Fetch the label with its Arena metadata and BOM children
gladiator get-files 109-1182 --recursive --meta-data --out 109-1182

# Write the manifest and show Build Words and media warnings, offline
lumenlabel label import 109-1182 --dry-run

# Import into the LumenLabel running on this computer
lumenlabel label import 109-1182

# Or remember a station once, then import into it
lumenlabel login --station https://fleet.cloud.lumenradio.com/v1/s/<uid>
lumenlabel label import 109-1182
lumenlabel label list
```

## Commands

```
lumenlabel [--station URL] [--token TOKEN] COMMAND   # global options first

lumenlabel login --station URL [--token TOKEN]
  # Checks the station and remembers it, with its token, in
  # ~/.config/lumenlabel/login.json (0600). Every later command then talks
  # to that station as if it were the local one. --base-url is an alias of
  # --station, as in lumentest.
lumenlabel logout

lumenlabel label import DIR [--dry-run] [--invalidate] [--output rich|json]
lumenlabel label list   [--output rich|json]
lumenlabel label remove ARTICLE [--yes]

lumenlabel station      [--output rich|json]       # info
lumenlabel station history [--limit N] [--before ID]
lumenlabel station logs [--tail N]

lumenlabel api METHOD PATH [--data JSON|@FILE]     # any /api/ endpoint
lumenlabel --version
```

## Which station

1. `--station URL` (alias `--base-url`), or `LUMENLABEL_STATION` /
   `LUMENLABEL_URL`.
2. The station saved by `lumenlabel login`.
3. The LumenLabel on this computer, `http://127.0.0.1:<port>`. The port is
   read from the station's `lumenlabel.json` (default 17081).

| URL | Authentication |
|---|---|
| `https://<fleet>/v1/s/<uid>` (Fleet relay) | Your Fleet sign-in (`fleet login`; the first command opens the browser if needed) |
| `http://127.0.0.1:<port>` (on the station) | None |
| `http://<station>:<port>` (LAN, `instrumentation.host` `0.0.0.0` on the station) | The station token, shown in admin mode on the station |

## `label import`

- The manifest (`artifact-manifest.json`) is built from the `.arena.json`
  sidecars gladiator writes with `--meta-data`. A folder with a manifest and no
  sidecars is imported as it is.
- Private attachments (NiceLabel `.nlbl` sources), web links and BOM child
  folders are left out. Only the declared files are uploaded.
- The media in `configuration.json` (`media_article`, `media_name`) is checked
  against the BOM's 111 item. A mismatch is a warning; fix it with a new
  revision in Arena. The CLI never changes `configuration.json`.
- A read-only folder (a write-protected USB stick) is imported through a
  temporary copy.
- An interrupted import resumes: run it again and only the files that did not
  arrive are sent. `--invalidate` discards what the station has staged.
- The output shows the revision, the Build Words, the media and any warnings.

Specification: `doc/label-package.md` and `doc/api-reference.md` in the
[LumenLabel repository](https://gitlab.com/lumenradio/production/lumenlabel).
