mirror of
https://github.com/jackwener/OpenCLI.git
synced 2026-09-14 18:25:42 +08:00
1ae1c82c4a
* feat(spotify): add Spotify playback adapter Adds a new adapter for controlling Spotify via the official Web API. Uses Strategy.PUBLIC with OAuth2 — no browser session required. Commands: auth, status, play, pause, next, prev, volume, search, queue, shuffle, repeat. Credentials are loaded from ~/.opencli/spotify.env or environment variables. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(spotify): rename index.ts → spotify.ts and fix CliError calls - Renamed src/clis/spotify/index.ts to spotify.ts so the build-manifest picks it up (index.js is intentionally excluded from manifest scanning) - Fixed 4 CliError calls: constructor now requires (code, message, hint?) so each throw now passes an appropriate error code as first argument Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(spotify): fix token refresh corruption, env parse, null guards, validation - refreshAccessToken: check res.ok before parsing; construct Tokens object directly instead of mutating loadTokens() result to avoid writing undefined/NaN on Spotify error responses; preserve existing refresh_token when Spotify omits it from the response - loadEnv: split on first '=' only so values containing '=' are preserved - SCOPES: remove write/library/top scopes not used by any command - status: guard against data.item being null (active device but no track) - volume: validate 0-100 range before API call - auth: check tokenRes.ok on initial token exchange; add server.on('error') handler for EADDRINUSE; add 5-minute timeout with clearTimeout on close * feat(postinstall): auto-create ~/.opencli/spotify.env template on install Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(spotify): guard null progress, podcast items, missing tracks data, corrupted tokens, invalid search limit Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(spotify): improve missing credentials error with step-by-step guidance * fix(spotify): harden setup and add docs coverage --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: jackwener <jakevingoo@gmail.com>
1.8 KiB
1.8 KiB
Spotify
Mode: 🔑 OAuth API · Domains: accounts.spotify.com, api.spotify.com
Commands
| Command | Description |
|---|---|
opencli spotify auth |
Authenticate with Spotify and store tokens locally |
opencli spotify status |
Show current playback status |
opencli spotify play [query] |
Resume playback or search-and-play a track |
opencli spotify pause |
Pause playback |
opencli spotify next |
Skip to the next track |
opencli spotify prev |
Skip to the previous track |
opencli spotify volume <0-100> |
Set playback volume |
opencli spotify search <query> |
Search Spotify tracks |
opencli spotify queue <query> |
Add a track to the playback queue |
| `opencli spotify shuffle <on | off>` |
| `opencli spotify repeat <off | track |
Usage Examples
# First-time setup
opencli spotify auth
# What is playing right now?
opencli spotify status
# Resume playback
opencli spotify play
# Search and immediately play a track
opencli spotify play "Numb Linkin Park"
# Search without playing
opencli spotify search "Daft Punk" --limit 5 -f json
# Queue a track
opencli spotify queue "Get Lucky"
# Playback controls
opencli spotify pause
opencli spotify next
opencli spotify prev
opencli spotify volume 35
opencli spotify shuffle on
opencli spotify repeat track
Setup
- Create a Spotify app at https://developer.spotify.com/dashboard
- Add
http://127.0.0.1:8888/callbackto the app's Redirect URIs - Fill in
SPOTIFY_CLIENT_IDandSPOTIFY_CLIENT_SECRETin~/.opencli/spotify.env - Run
opencli spotify auth
Notes
- Browser Bridge is not required.
- Tokens are stored locally at
~/.opencli/spotify-tokens.json. - Playback commands work best when you already have an active Spotify device/session.