Skip to main content

Melodee CLI

Imported component documentation. Source: melodee-project/melodee-cli at commit 824e49fddb4dcc071fc8e72558aadea224704447. Version 2026.11.0-rc.1. License MIT. Status: source candidate; complete gate and disposable live suite are the qualification authority; not published and not production-qualified. This is the component's committed documentation, not proof of a distribution release or production qualification.

Native command-line access to Melodee's Canonical Music Architecture.

API design Contract Version Rust License

Status: 2026.11.0-rc.1 source candidate — the complete unfiltered gate and the disposable live suite are the qualification authority; not published and not production-qualified. The executable is melodee; it never accesses the Catalog database or media volumes directly and never evaluates MQL or canonical identity locally.

The CLI implements the native API 1.0.0 surface authorized for a client:

  • C0–C2 configuration profiles, environment/CLI overrides, bounded transport, doctor/health, shell completion, local playlist/concert drafts, and schema-1 historical archive verification.
  • C3 contract negotiation, search, Artist/Release/Track browsing, artwork and favorites.
  • C4 device authorization (scoped 30-day automation credential), encrypted Linux OS credential storage, status, refresh/logout, and a separate native interactive magic-link session with rotation.
  • C5 server-owned MQL (registry/validate/execute/preview), static/dynamic/ concert playlists (occurrence-preserving, revision-bound, import/export), independent favorites/ratings/dislikes, preferences and genre exclusions, autoplay, listening history/statistics, and two-phase user-state portability.
  • C6 all 76 administrative operations: reports/CSV, jobs/schedules/SSE and inventory, storage volumes/assets/inbound/moves/quarantine, catalog admin and review evidence, corrections/legacy/quality, artwork, providers, account lifecycle/capabilities/sessions, notifications, metrics and generic typed dispatch.
  • C7 deterministic Linux x86_64/ARM64 packaging preparation, checksums, completions, release metadata, CI verification and upgrade/rollback runbooks.

A disposable harness builds the exact tagged API v1.0.0, an isolated PostgreSQL cluster, temporary Storage Volumes and synthetic media, then drives the compiled CLI over HTTP only. See live qualification.

Start here​

cargo fmt --all
python3 scripts/do-prechecks.py
cargo install --locked --path .
melodee --help
melodee version -o json

The complete gate validates the vendored OpenAPI artifact/drift, docs/fixtures, Python syntax, hygiene, CalVer metadata, locked metadata, toolchain, formatting, Clippy, build, tests, dependency licence/ban/source policy, RustSec advisories and release packaging. Missing tools, warnings or advisories fail; they are not skipped. See verification evidence.

Authentication​

melodee profile add home --url https://melodee.example.test

# Device grant: scoped, 30-day automation credential. Not refreshable.
melodee --profile home auth login --scope catalog.read --scope catalog.favorite.write
melodee --profile home auth status --verify

# Native interactive session: rotating, account-rights, for MQL/playlists/
# listener state/history/sharing/notifications/account security.
melodee --profile home auth login --method magic-link --email you@example.test
melodee --profile home auth refresh

melodee --profile home auth logout

Both credential families are stored with Linux user-scoped systemd-creds (systemd 256+), never in TOML, arguments, stdout or logs, with no plaintext fallback. The device grant is not a refreshable session; the CLI never refreshes it. The magic-link session is a separate published native path with single-flight rotation and one bounded retry after a 401. Browser approval, passkey ceremonies, Google browser callbacks and recovery remain browser-owned.

Unattended automation credentials are supported without the OS store:

# Disposable/isolated test or automation only; never commit or log it.
export MELODEE_AUTOMATION_TOKEN="$(cat /run/secrets/melodee-test-token)"
# Or a regular file with mode 0600:
melodee --token-file ~/.config/melodee/token favorite list

Tokens are sent only as a bearer header to loopback or HTTPS origins, never through redirects or to another origin. One-time share/automation/compatibility secrets are written only to private --out files.

Examples​

melodee server status -o json
melodee server capabilities -o json
melodee doctor

melodee search 'Étoile' --limit 10
melodee release show <release-id> -o json
melodee track show <track-id> -o json
melodee favorite add <track-id>
melodee artwork show <artwork-id> --revision 1 --size 250 --out cover.jpg

# C5 listener state (interactive session)
melodee mql fields
melodee mql validate "artist.name = 'Björk' and preference.rating >= 4"
melodee mql execute "genre.name in ['Rock', 'Pop']" --limit 25
melodee playlist create --title "Live" --kind concert \
--concert-date 2026-12-31 --concert-venue "Hall"
melodee playlist add-entry <playlist-id> --track <track-id> --revision 1 \
--section encore --note guest
melodee playlist add-entry <playlist-id> --track <track-id> --revision 2 # deliberate repeat
melodee playlist export <playlist-id> --out playlist.json
melodee playlist import playlist.json --mode create --idempotency-key import-1

melodee listener rating set <track-id> 5
melodee listener dislike set <track-id>
melodee listener preferences exclude-genre <genre-id>
melodee playback autoplay --limit 10
melodee playback report --track <track-id> --event-id play-1 --played-ms 180000 \
--completion completed
melodee history list --limit 20
melodee history stats --timezone America/Chicago

melodee state export --out state.json
melodee state inspect state.json
melodee state preview state.json --mapping legacy-track-1=<track-id> \
--idempotency-key migration-1
melodee state apply <plan-id> --revision 1 --yes

melodee share create --target-kind playlist --target-id <playlist-id> \
--expires-in-days 7 --out share.json --yes
melodee share view --token-file share-token

# C6 administration (scope + account capability)
melodee admin reports catalog -o json
melodee admin reports catalog -o csv --out catalog.csv
melodee admin jobs list --state failed
melodee admin jobs watch <job-id>
melodee admin storage assets --preferred
melodee admin storage inbound --volume <volume-id>
melodee admin catalog review-show <review-id>
melodee admin catalog track genres <track-id> --genre Rock --yes
melodee admin accounts list
melodee admin accounts status <account-id> --status disabled --yes
melodee admin metrics
melodee admin coverage

melodee playlist validate docs/examples/playlist.json
melodee concert validate docs/examples/concert.json -o json
melodee legacy verify /path/to/legacy-user-state.zip -o json
melodee mql inspect docs/examples/legacy-mql.json
melodee completion bash

Verification​

  • Fast tests: unit + controlled loopback mocks; no database, network or service.
  • Real-service qualification: python3 scripts/c3/live.py verifies tag v1.0.0, builds a clean API and seed helper, creates isolated PostgreSQL, two temporary Storage Volumes and synthetic media, logs in via the device grant and a loopback SMTP magic link, exercises C3–C6 over HTTP only, runs upstream server tests, measures resources and removes everything. The sanitized report is C3-LIVE-REPORT.json.
  • Flagship mapping: S1-06 CLI proof.
  • Evidence: C4 authentication, C5 listener state, C6 administration, admin coverage, C7 release, contract audit.
  • Reproducible packaging: SOURCE_DATE_EPOCH=0 ./scripts/package-release.sh; verify with ./scripts/package-release.sh --check.

Documentation​

GuideContent
InstallationBinary/source install, completions, credential-store prerequisite, upgrade/rollback
ConfigurationProfiles, credential families, session rotation, transport security
CommandsComplete command surface, output and exit codes
AdministrationAll 76 admin operations, scopes/capabilities, safeguards
MigrationPortable user-state workflow and historical archive verification
DevelopmentGate, contract pinning, live harness, packaging
Release preparationCalVer, artifacts, reproducibility, signing preparation

Design and implementation​

DocumentPurpose
PRDProduct scope and numbered requirements
SPECCLI boundaries, contracts, security and formats
IMPLEMENTATIONDependency-ordered work packets and acceptance
ROADMAPCross-repository milestones
ACCEPTANCEObservable success and failure cases
STATUSImplementation, verification and qualification ledger
COMPLETION-AUDITMaster C0–C7 completion audit
ADRsDecisions and rationale
OpenAPI provenancePinned v1.0.0 artifact, digest and refresh policy
API contract summaryOperations, authentication boundary, wire conventions
Legacy schema-1 dossierRedacted observed export format
Agent instructionsRepository rules and completion gate

Project relationships​

  • melodee-api — sole authority for canonical identity, authorized operations, MQL and the native API.
  • melodee-admin-ui — administrative and editorial UI.
  • melodee-auth-ui — separate account/authentication UI.
  • melodee-android-app and meloamp — existing listening clients.

See LICENSE. This client follows the upstream API's MIT license direction; the repository owner confirms publication policy before release.