Commands
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
| Command | Behavior |
|---|---|
profile add NAME --url URL | Add profile; no duplicate overwrite |
profile list / use NAME / show [NAME] | Manage/select a non-secret profile |
status / server health | Unauthenticated 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 status | Liveness + pinned-contract negotiation; authenticated capabilities when a token is present |
server capabilities | Authenticated server capability discovery |
doctor | Config/liveness; with a token or stored login, contract + capability + auth negotiation |
version | CLI 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 ID | Release page / Release with ordered memberships |
track list [...] / track show ID | Track page / Track with preferred asset |
favorite list [...] | Account-scoped favorite page |
favorite show TRACK_ID / add / remove | Explicit, 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 SHELL | Raw shell completion script |
Authentication and credentials
| Command | Behavior |
|---|---|
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 FILE | One-time installation bootstrap; stores the native session |
auth status [--verify] | Credential type, account, scopes/deadlines and storage; --verify checks server capabilities |
auth refresh | Rotates 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 methods | Enabled authentication methods and operator prerequisites |
auth sessions list / revoke ID --yes / revoke-others --yes | Interactive session inventory and revocation |
auth identities list / unlink ID --yes | Linked external identities |
auth passkeys list / revoke ID --yes / label ID --label TEXT | Passkey metadata and revocation; registration/assertion ceremonies remain browser-owned |
auth automation list / issue ... --out FILE --yes / revoke ID --yes | Scoped automation credentials; one-time token only in a private file |
auth compatibility list [--protocol] / create --protocol ... --label ... --out FILE --yes / revoke ID --yes | One-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)
| Command | Behavior |
|---|---|
mql fields | Versioned 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 FILE | Local 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
| Command | Behavior |
|---|---|
playlist list / show ID | Bounded 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 --yes | Retire 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 N | Remove 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 FILE | Local 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
| Command | Behavior |
|---|---|
listener state TRACK | {favorite, rating, disliked} as independent facts |
listener rating set TRACK 1..5 / clear TRACK | Rating only; does not change favorite/dislike |
listener dislike set TRACK / clear TRACK | Dislike affects automatic playback only |
listener preferences show | Complete 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 genres | Closed, 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-millis | Explicit 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
| Command | Behavior |
|---|---|
state export [--out FILE] | Exact melodee-user-state/1 export; the server digest is preserved |
state inspect FILE | Local 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] --yes | Revision-bound batch; repeat until status: applied |
state apply-job ID --yes | Durable 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 TRACK | Review and resolve legacy references |
legacy inspect FILE / legacy verify FILE | C2B 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
| Command | Behavior |
|---|---|
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 --yes | Creates a bounded revocable share; one-time token only in the private file. Dynamic playlists are refused by the API |
share revoke ID --yes | Immediate revocation |
share view --token-file FILE [--limit] [--cursor] | Unauthenticated recipient view |
share stream --token-file FILE --track TRACK --out FILE | Unauthenticated shared Track stream |
notification list [--limit] [--unread-only] / read ID / read-all | Personal in-app inbox (interactive session) |
notification subscriptions / set-subscriptions FILE / subscribe ... / unsubscribe --channel | Complete or targeted subscription management (interactive session) |
Administration (all 76 published admin operations)
| Command | Behavior |
|---|---|
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 --kind | Immutable report snapshots |
admin jobs list [--state] [--kind] [--from-millis] ... | Bounded job inventory |
admin jobs controls|control|schedules|schedule-create|schedule-update|schedule-delete|run-due | Job controls and schedules; delete retires and retains history |
admin jobs show|cancel|retry|progress|events|watch ID | Job 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-update | Volume, asset and inbound inventory/policy |
admin storage move|enqueue-move|quarantine|release | Verified 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|split | Review/correction/legacy/quality/identity workflows |
admin artwork upload|fetch|prune|prune-cache | Artwork administration; upload is raw JPEG/PNG (1 byte–10 MiB) |
admin providers circuits|reset | Provider circuit inspection/reset |
admin accounts list|show|status|grant|revoke|revoke-sessions | Account lifecycle, capabilities and session revocation; disabling revokes sessions and automation credentials |
admin notifications list|test --yes | Sanitized delivery rows and a controlled test |
admin metrics | Prometheus 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 coverage | Offline 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.