Skip to main content

Commands

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.

Implemented and verified against the pinned native API contract 1.0.0. Run melodee --help for the exact current surface. There are no placeholder commands for unavailable contracts.

The CLI is an API client: it never opens PostgreSQL, reads a Storage Volume directly, resolves canonical identity itself, evaluates MQL or invents a server route. Administrative and listener-state commands use only published operations.

Foundation and catalog​

CommandBehavior
profile add NAME --url URLAdd profile; no duplicate overwrite
profile list / use NAME / show [NAME]Manage/select a non-secret profile
status / server healthUnauthenticated liveness only; readiness_verified stays false because the pinned artifact publishes no readiness operation (the server's /readyz is not in the 1.0.0 contract, and the CLI does not call unpublished routes)
server statusLiveness + pinned-contract negotiation; authenticated capabilities when a token is present
server capabilitiesAuthenticated server capability discovery
doctorConfig/liveness; with a token or stored login, contract + capability + auth negotiation
versionCLI CalVer version, release channel, pinned/supported API contract
search QUERY [--limit N]Global Artist/Release/Track search
artist list [--limit N] [--cursor C]Bounded Artist page
release list [...] / release show IDRelease page / Release with ordered memberships
track list [...] / track show IDTrack page / Track with preferred asset
favorite list [...]Account-scoped favorite page
favorite show TRACK_ID / add / removeExplicit, idempotent favorite fact
artwork show ID --revision N --size 100|250|500 --out FILE [--if-none-match ETAG]Immutable public JPEG variant; streams to a private file; 304 leaves the file untouched
completion SHELLRaw shell completion script

Authentication and credentials​

CommandBehavior
auth login [--method device] [--scope S] [--client-id ID]Device grant; issues a scoped, 30-day automation credential. Prints the user code and server-supplied verification URI on stderr; the CLI never approves it
auth login --method magic-link --email EMAIL [--link-token-file FILE]Requests a magic link and confirms the one-time token as a native client (stdin when no file); stores a rotating interactive session
auth bootstrap --code-file FILEOne-time installation bootstrap; stores the native session
auth status [--verify]Credential type, account, scopes/deadlines and storage; --verify checks server capabilities
auth refreshRotates the stored interactive session once (not valid for automation credentials)
auth logout [--local-only]Automation: self-revoke endpoint. Session: POST /auth/logout. Removes the local credential only after success; --local-only is explicit
auth methodsEnabled authentication methods and operator prerequisites
auth sessions list / revoke ID --yes / revoke-others --yesInteractive session inventory and revocation
auth identities list / unlink ID --yesLinked external identities
auth passkeys list / revoke ID --yes / label ID --label TEXTPasskey metadata and revocation; registration/assertion ceremonies remain browser-owned
auth automation list / issue ... --out FILE --yes / revoke ID --yesScoped automation credentials; one-time token only in a private file
auth compatibility list [--protocol] / create --protocol ... --label ... --out FILE --yes / revoke ID --yesOne-time OpenSubsonic/Jellyfin secrets only in a private file

The device grant is not a refreshable interactive session; the CLI never refreshes it. The interactive magic-link/bootstrap path is separate and follows the published rotateAtMillis contract with single-flight rotation and one bounded retry after a 401. Both credential families are stored in the Linux user-scoped systemd-creds store; there is no plaintext fallback.

MQL (server-owned)​

CommandBehavior
mql fieldsVersioned mql/1 field registry
mql validate QUERY|--file FILE [--fail-on-invalid]Server validation; structured diagnostics with UTF-8 byte offsets. Invalid is a normal 200 answer unless --fail-on-invalid requests exit 4
mql execute QUERY|--file FILE [--limit] [--cursor]Server execution; bounded page and opaque cursor
mql preview QUERY|--file FILE [--limit] [--cursor]Read-only execution with a small default page; never stores anything
mql inspect FILELocal historical wrapper/raw text inspection only; not a validator

Local query checks are limited to transport bounds; authoritative validation always comes from the server.

Playlists​

CommandBehavior
playlist list / show IDBounded playlist inventory / detail with ordered occurrences and dynamic evaluation
playlist create --title ... --kind static|dynamic|concert [--mql] [--concert-*]Static, dynamic (saved MQL) or concert playlist
playlist update ID --revision N [--title] [--description|--clear-description] [--visibility] [--mql] [--concert-*]Metadata/MQL/concert edits at the current revision
playlist delete ID --revision N --yesRetire the playlist; history is retained
playlist add-entry ID --track TRACK --revision N [--position] [--section] [--note]Append or insert one occurrence
playlist move-entry ID ENTRY --revision N --position P [...]Move an occurrence; update section/note
playlist remove-entry ID ENTRY --revision NRemove one occurrence and close the gap
playlist order ID --revision N --entry-id E ...Full reorder naming every occurrence once
playlist export ID [--revision N] [--out FILE] / playlist snapshot ...Point-in-time melodee-playlist/1 snapshot; dynamic playlists carry their MQL
playlist import FILE --mode create|append|replace --idempotency-key KEY [--playlist ID --revision N] [--yes]melodee-playlist/1 or published import body; replay-safe and atomic
playlist validate FILELocal draft structure only

Entry ids are stable occurrence ids, never Track ids. Deliberate repeated Tracks are preserved and never deduplicated. A stale mutation is a server 409 revision_conflict; the CLI does not retry it blindly.

Listener state, history and playback​

CommandBehavior
listener state TRACK{favorite, rating, disliked} as independent facts
listener rating set TRACK 1..5 / clear TRACKRating only; does not change favorite/dislike
listener dislike set TRACK / clear TRACKDislike affects automatic playback only
listener preferences showComplete playback preferences
listener preferences set --autoplay-enabled BOOL --prefer-lossless BOOL --scrobble-enabled BOOL [--exclude-genre ID ...]Complete replacement
listener preferences exclude-genre ID ... / include-genre ID ...Targeted read-modify-write; preserves other facts
listener genresClosed, versioned canonical genre registry
playback autoplay [--limit] [--seed]Deterministic bounded automatic-playback candidates and policy
playback report --track TRACK --event-id ID --played-ms N --completion --occurred-at-millisExplicit play fact; qualification is server-owned and idempotent by event id
history list [--from-millis] [--to-millis] [--limit] [--cursor]Qualified personal plays, newest first
history recent [--limit]Distinct recently played Tracks with counts
history stats [--from-millis] [--to-millis] [--timezone IANA] [--limit]Totals, local-day buckets and Track/Artist/Release charts

User-state portability​

CommandBehavior
state export [--out FILE]Exact melodee-user-state/1 export; the server digest is preserved
state inspect FILELocal schema/bounds validation and canonical SHA-256 verification; digest mismatch exits 4
state preview FILE [--mapping LEGACY=TRACK ...] [--target-account ID] [--idempotency-key KEY] [--out FILE]Non-mutating two-phase preview with conflicts and unresolved references
state plans [--limit] / state plan ID [--limit] [--cursor]Plan inventory and decision detail
state apply ID --revision N [--limit 1..1000] --yesRevision-bound batch; repeat until status: applied
state apply-job ID --yesDurable import job; progress via admin jobs watch, cancellation via admin jobs cancel where the account holds admin_jobs
state unresolved [--include-resolved] / state resolve ID --track TRACKReview and resolve legacy references
legacy inspect FILE / legacy verify FILEC2B schema-1 archive structure/verification, read-only and local

Preview never writes listener state. Apply requires the current planRevision and explicit --yes. Import is conservative: favorites/dislikes are added if absent, ratings are replaced only when strictly newer, existing summaries or preferences become conflicts, and playlists are create-only. The CLI never applies the owner's real archive.

Sharing and notifications​

CommandBehavior
share list [--limit]Owner share inventory; tokens are never listed
share create --target-kind playlist|release|track --target-id ID [--expires-in-days] [--max-uses] --out FILE --yesCreates a bounded revocable share; one-time token only in the private file. Dynamic playlists are refused by the API
share revoke ID --yesImmediate revocation
share view --token-file FILE [--limit] [--cursor]Unauthenticated recipient view
share stream --token-file FILE --track TRACK --out FILEUnauthenticated shared Track stream
notification list [--limit] [--unread-only] / read ID / read-allPersonal in-app inbox (interactive session)
notification subscriptions / set-subscriptions FILE / subscribe ... / unsubscribe --channelComplete or targeted subscription management (interactive session)

Administration (all 76 published admin operations)​

CommandBehavior
admin reports catalog|ingestion|storage|jobs|providers|quality [--from-millis] [--to-millis] [--timezone] [--out FILE]JSON/table or streamed server CSV
admin reports snapshots / snapshot ID / capture --kindImmutable report snapshots
admin jobs list [--state] [--kind] [--from-millis] ...Bounded job inventory
admin jobs controls|control|schedules|schedule-create|schedule-update|schedule-delete|run-dueJob controls and schedules; delete retires and retains history
admin jobs show|cancel|retry|progress|events|watch IDJob inspection, controls and SSE
admin jobs enqueue-ingest|enqueue-normalize VOLUME ...Native ingest/normalize enqueue for an active volume and safe inbound path
admin storage volumes|assets|inbound|volume-updateVolume, asset and inbound inventory/policy
admin storage move|enqueue-move|quarantine|releaseVerified move, queued move and quarantine lifecycle
admin catalog artist|release|track ...Aliases, locks, classification, asset lock, preferred asset, merge, quality, editorial genres
admin catalog reviews|review-show|review-resolve|corrections|legacy|quality|match-decision|splitReview/correction/legacy/quality/identity workflows
admin artwork upload|fetch|prune|prune-cacheArtwork administration; upload is raw JPEG/PNG (1 byte–10 MiB)
admin providers circuits|resetProvider circuit inspection/reset
admin accounts list|show|status|grant|revoke|revoke-sessionsAccount lifecycle, capabilities and session revocation; disabling revokes sessions and automation credentials
admin notifications list|test --yesSanitized delivery rows and a controlled test
admin metricsPrometheus text exposition
admin api OPERATION_ID [--param K=V] [--query K=V] [--data JSON] [--yes]Low-level typed operation dispatch by published operation id
admin coverageOffline API-to-CLI coverage matrix with scope, response schema and live status

Administrative commands require the credential scope and the matching account capability. A 403 is surfaced as SCOPE_REQUIRED, CAPABILITY_REQUIRED, INTERACTIVE_SESSION_REQUIRED or AUTHORIZATION_DENIED. The 1.0.0 transport permits automation credentials on catalog/favorite/playback and administrative routes; MQL, playlists, listener preferences/ratings/dislikes, user state, history, shares, notifications, automation-token and compatibility-credential management require an interactive session. admin notifications list|test is restricted to an interactive session despite the administrative tag.

Global behavior​

Global flags: --output/-o table|json|csv, --config, --server, --profile, --token-file, --allow-http, --timeout-secs (1–120). A credential is read, in order, from --token-file, MELODEE_AUTOMATION_TOKEN, or the encrypted stored login for the selected profile/server. It is never a CLI value or config field. auth login/logout refuse to run while an explicit token source is active. A bearer is sent only to a loopback or HTTPS origin. --profile and --server conflict; token/profile/server flags do not apply to local-only commands.

Destructive or sensitive operations print the target and require --yes; no request is sent without it. Non-idempotent calls are never retried except the single interactive-session refresh retry after a 401, which is safe because the server rejected the request before executing it. Reports can be written with --out; -o csv streams the server CSV without buffering the whole body. Destroyed stdout pipes are handled without a panic.

JSON object reports are the contract output. List reports carry items + next_cursor or grouped artists/releases/tracks; table output renders typed rows and CSV renders a record projection, neither a lossless native export. Table controls and bidi overrides are escaped. Diagnostics go to stderr.

Exit codes: 0 success, 2 usage, 3 configuration or missing/invalid token source, 4 invalid input/limit/unsupported local schema or failed local verification, 5 I/O, 6 transport/HTTP or server error, 7 contract/version mismatch or malformed response.

Server errors preserve the upstream machine code and correlation id, for example:

{"code":"AUTH_ERROR","message":"catalog.favorite.write scope required","server_code":"forbidden","http_status":403,"request_id":"…"}

A successful legacy verify is not a migration; a search/read is not canonical resolution; a favorite mutation is explicit state, not an import; a preview is not an apply. Browser-owned operations (WebAuthn registration/assertion ceremonies, Google browser callbacks, device approval, contact verification, password recovery, installation UI) are not exposed as CLI commands; their supported alternatives are the Auth UI or Admin UI.