feat(spotify): add Spotify playback adapter#560
Open
bhutano wants to merge 6 commits intojackwener:mainfrom
Open
feat(spotify): add Spotify playback adapter#560bhutano wants to merge 6 commits intojackwener:mainfrom
bhutano wants to merge 6 commits intojackwener:mainfrom
Conversation
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>
- 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>
…alidation
- 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
…tall Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…, corrupted tokens, invalid search limit Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
spotifyadapter undersrc/clis/spotify/Strategy.PUBLIC— no browser required, direct calls to the Spotify Web API~/.opencli/spotify-tokens.json)~/.opencli/spotify.envor environment variablesCommands
opencli spotify authopencli spotify statusopencli spotify search <query>opencli spotify play [query]opencli spotify pauseopencli spotify nextopencli spotify prevopencli spotify volume <0-100>opencli spotify queue <query>opencli spotify shuffle on|offopencli spotify repeat off|track|contextSetup
http://127.0.0.1:8888/callback~/.opencli/spotify.envwith yourSPOTIFY_CLIENT_IDandSPOTIFY_CLIENT_SECRETopencli spotify authonce to authenticateTest plan
opencli spotify authopens browser and saves tokensopencli spotify play "Bohemian Rhapsody"starts playbackopencli spotify statusreturns current track infoopencli spotify pause/next/prevwork correctlyopencli spotify volume 50sets volume