@bzenky/spoti 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +99 -19
- package/dist/app.d.ts +4 -6
- package/dist/app.js +124 -88
- package/dist/app.js.map +1 -1
- package/dist/auth/spotify-auth-client.js +12 -7
- package/dist/auth/spotify-auth-client.js.map +1 -1
- package/dist/cli.js +18 -6
- package/dist/cli.js.map +1 -1
- package/dist/services/auth.service.d.ts +4 -1
- package/dist/services/auth.service.js +32 -4
- package/dist/services/auth.service.js.map +1 -1
- package/dist/services/catalog.service.d.ts +2 -0
- package/dist/services/catalog.service.js +29 -4
- package/dist/services/catalog.service.js.map +1 -1
- package/dist/services/device.service.d.ts +1 -1
- package/dist/services/device.service.js +2 -1
- package/dist/services/device.service.js.map +1 -1
- package/dist/services/library.service.d.ts +2 -0
- package/dist/services/library.service.js +17 -2
- package/dist/services/library.service.js.map +1 -1
- package/dist/services/models.d.ts +3 -0
- package/dist/services/pagination.d.ts +20 -0
- package/dist/services/pagination.js +11 -0
- package/dist/services/pagination.js.map +1 -0
- package/dist/services/player.service.d.ts +2 -1
- package/dist/services/player.service.js +19 -9
- package/dist/services/player.service.js.map +1 -1
- package/dist/services/playlist.service.d.ts +4 -0
- package/dist/services/playlist.service.js +32 -14
- package/dist/services/playlist.service.js.map +1 -1
- package/dist/services/queue.service.d.ts +2 -2
- package/dist/services/queue.service.js +9 -4
- package/dist/services/queue.service.js.map +1 -1
- package/dist/services/recent.service.d.ts +2 -0
- package/dist/services/recent.service.js +53 -2
- package/dist/services/recent.service.js.map +1 -1
- package/dist/services/update.service.d.ts +8 -0
- package/dist/services/update.service.js +11 -1
- package/dist/services/update.service.js.map +1 -1
- package/dist/spotify/client.d.ts +5 -2
- package/dist/spotify/client.js +45 -16
- package/dist/spotify/client.js.map +1 -1
- package/dist/spotify/types.d.ts +1 -0
- package/dist/tui/app.d.ts +23 -0
- package/dist/tui/app.js +247 -0
- package/dist/tui/app.js.map +1 -0
- package/dist/tui/devices-screen.d.ts +10 -0
- package/dist/tui/devices-screen.js +156 -0
- package/dist/tui/devices-screen.js.map +1 -0
- package/dist/tui/index.d.ts +2 -0
- package/dist/tui/index.js +11 -0
- package/dist/tui/index.js.map +1 -0
- package/dist/tui/input.d.ts +5 -0
- package/dist/tui/input.js +10 -0
- package/dist/tui/input.js.map +1 -0
- package/dist/tui/library-screen.d.ts +41 -0
- package/dist/tui/library-screen.js +264 -0
- package/dist/tui/library-screen.js.map +1 -0
- package/dist/tui/navigation.d.ts +18 -0
- package/dist/tui/navigation.js +54 -0
- package/dist/tui/navigation.js.map +1 -0
- package/dist/tui/queue-screen.d.ts +12 -0
- package/dist/tui/queue-screen.js +248 -0
- package/dist/tui/queue-screen.js.map +1 -0
- package/dist/tui/screens.d.ts +8 -0
- package/dist/tui/screens.js +47 -0
- package/dist/tui/screens.js.map +1 -0
- package/dist/tui/search-screen.d.ts +30 -0
- package/dist/tui/search-screen.js +213 -0
- package/dist/tui/search-screen.js.map +1 -0
- package/dist/tui/viewport.d.ts +7 -0
- package/dist/tui/viewport.js +18 -0
- package/dist/tui/viewport.js.map +1 -0
- package/dist/ui/completions.js +25 -18
- package/dist/ui/completions.js.map +1 -1
- package/dist/ui/pagination.d.ts +30 -0
- package/dist/ui/pagination.js +72 -0
- package/dist/ui/pagination.js.map +1 -0
- package/dist/ui/prompts.d.ts +17 -8
- package/dist/ui/prompts.js +57 -35
- package/dist/ui/prompts.js.map +1 -1
- package/dist/ui/watch.d.ts +13 -0
- package/dist/ui/watch.js +40 -12
- package/dist/ui/watch.js.map +1 -1
- package/dist/utils/errors.d.ts +4 -0
- package/dist/utils/errors.js +22 -2
- package/dist/utils/errors.js.map +1 -1
- package/package.json +7 -3
- package/dist/ui/interactive-search.d.ts +0 -36
- package/dist/ui/interactive-search.js +0 -337
- package/dist/ui/interactive-search.js.map +0 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ A local-first command-line client for controlling Spotify through Spotify Connec
|
|
|
8
8
|
|
|
9
9
|
## Requirements
|
|
10
10
|
|
|
11
|
-
- Node.js
|
|
11
|
+
- Node.js 22 or newer
|
|
12
12
|
- A Spotify developer application and client ID
|
|
13
13
|
- Spotify Premium for playback-control commands
|
|
14
14
|
- A Spotify client or Connect device available for playback
|
|
@@ -41,12 +41,24 @@ The setup command stores the public client ID in your local `spoti` configuratio
|
|
|
41
41
|
export SPOTIFY_CLIENT_ID="your-client-id"
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
+
PowerShell:
|
|
45
|
+
|
|
46
|
+
```powershell
|
|
47
|
+
$env:SPOTIFY_CLIENT_ID = "your-client-id"
|
|
48
|
+
```
|
|
49
|
+
|
|
44
50
|
The environment variable takes precedence over the stored value. To use a different local callback, register it in the same Spotify application and set:
|
|
45
51
|
|
|
46
52
|
```bash
|
|
47
53
|
export SPOTIFY_REDIRECT_URI="http://127.0.0.1:5000/callback"
|
|
48
54
|
```
|
|
49
55
|
|
|
56
|
+
PowerShell:
|
|
57
|
+
|
|
58
|
+
```powershell
|
|
59
|
+
$env:SPOTIFY_REDIRECT_URI = "http://127.0.0.1:5000/callback"
|
|
60
|
+
```
|
|
61
|
+
|
|
50
62
|
The redirect URI must use HTTPS except for local development, where an explicit `http://127.0.0.1` URI is allowed. Do not use `localhost` or wildcard redirect URIs. No client secret is needed or accepted by `spoti`; authentication uses Authorization Code with PKCE.
|
|
51
63
|
|
|
52
64
|
## Installation
|
|
@@ -81,20 +93,53 @@ npm run dev -- status
|
|
|
81
93
|
|
|
82
94
|
## Usage
|
|
83
95
|
|
|
84
|
-
Run `spoti` with no command to see the complete command overview:
|
|
96
|
+
Run `spoti` with no command, or use `spoti --help`, to see the complete command overview:
|
|
85
97
|
|
|
86
98
|
```bash
|
|
87
99
|
spoti
|
|
100
|
+
spoti --help
|
|
88
101
|
```
|
|
89
102
|
|
|
90
|
-
Open the interactive
|
|
103
|
+
Open the full interactive TUI explicitly:
|
|
91
104
|
|
|
92
105
|
```bash
|
|
93
106
|
spoti interactive
|
|
94
107
|
# alias: spoti i
|
|
95
108
|
```
|
|
96
109
|
|
|
97
|
-
|
|
110
|
+
The TUI opens on current playback, updates progress locally every second, and refreshes Spotify state every ten seconds only while the Player screen is active. Use:
|
|
111
|
+
|
|
112
|
+
```text
|
|
113
|
+
1 Player
|
|
114
|
+
/ Search
|
|
115
|
+
q Queue
|
|
116
|
+
d Devices
|
|
117
|
+
l Library
|
|
118
|
+
? Help
|
|
119
|
+
|
|
120
|
+
Space play or pause (Player)
|
|
121
|
+
n next track (Player)
|
|
122
|
+
p previous track (Player)
|
|
123
|
+
← / → seek backward or forward 10 seconds (Player)
|
|
124
|
+
- / + lower or raise volume by 5% (Player)
|
|
125
|
+
s toggle shuffle (Player)
|
|
126
|
+
r cycle repeat off, track, and context (Player)
|
|
127
|
+
Ctrl+R refresh now (Player)
|
|
128
|
+
|
|
129
|
+
Esc back one level, or exit from Player
|
|
130
|
+
x exit from Player or Help
|
|
131
|
+
Ctrl+X exit from Search, Queue, Devices, or Library
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
On Search, type a query and press Enter. Use up/down to select a result, then Enter to play it. Tab or left/right switches between tracks, albums, artists, and playlists. Search results are cached for the active TUI session, stale requests are cancelled when the query changes, and leaving Search cancels an in-flight search or playback request.
|
|
135
|
+
|
|
136
|
+
Queue displays the current item and Spotify's upcoming items. Press `a` to search for a track, use up/down to select it, and press Enter to add it. Press `r` to refresh. Spotify does not expose arbitrary queue removal or position jumping, so the TUI does not offer those actions.
|
|
137
|
+
|
|
138
|
+
Devices lists controllable Spotify Connect devices with active status, type, and volume. Use up/down and Enter to transfer playback, or `r` to refresh.
|
|
139
|
+
|
|
140
|
+
Library uses Tab or left/right to switch among Playlists, Liked, and Recent. Use up/down and Enter to open a playlist or play a track; `n` and `p` navigate lazily loaded pages. Previously visited pages remain cached for the TUI session, and Esc returns from playlist tracks to the playlist list before returning to Player.
|
|
141
|
+
|
|
142
|
+
All command-driven usage remains available. The `interactive` command requires an interactive stdin and stdout; outside a TTY it prints its command help instead of starting Ink.
|
|
98
143
|
|
|
99
144
|
Authenticate once through Spotify's browser authorization page:
|
|
100
145
|
|
|
@@ -103,19 +148,21 @@ spoti login
|
|
|
103
148
|
spoti status
|
|
104
149
|
```
|
|
105
150
|
|
|
106
|
-
Control playback
|
|
151
|
+
Control playback. Quotes are optional for ordinary multi-word queries because `spoti` combines the remaining command arguments. Use quotes when a query contains shell-special characters such as `&`, `*`, `?`, or parentheses.
|
|
107
152
|
|
|
108
153
|
```bash
|
|
109
154
|
spoti now
|
|
110
155
|
spoti now --watch
|
|
111
|
-
spoti play
|
|
112
|
-
spoti play
|
|
113
|
-
spoti play
|
|
114
|
-
spoti play
|
|
156
|
+
spoti play Numb
|
|
157
|
+
spoti play Fear of the Dark
|
|
158
|
+
spoti play Numb --first
|
|
159
|
+
spoti play Numb --watch
|
|
160
|
+
spoti play Numb --no-watch
|
|
115
161
|
spoti pause
|
|
116
162
|
spoti resume
|
|
117
163
|
spoti next
|
|
118
164
|
spoti previous
|
|
165
|
+
spoti volume
|
|
119
166
|
spoti volume 50
|
|
120
167
|
spoti volume +10
|
|
121
168
|
spoti volume -10
|
|
@@ -178,9 +225,9 @@ spoti play playlist "Workout"
|
|
|
178
225
|
spoti play playlist 1
|
|
179
226
|
```
|
|
180
227
|
|
|
181
|
-
User playlists
|
|
228
|
+
User playlists preserve Spotify’s order so their global displayed numbers remain stable across pages. A displayed number can be reused with `spoti playlist <number>` or `spoti play playlist <number>`, including numbers beyond the first page.
|
|
182
229
|
|
|
183
|
-
In an interactive terminal, `spoti album` can play the entire album or a selected track after showing its details. `spoti artist` can play the artist context or let you
|
|
230
|
+
In an interactive terminal, `spoti album` can play the entire album or a selected track after showing its details. `spoti artist` can play the artist context or let you browse the artist’s albums lazily, with each fetched page ordered from newest to oldest by release date. From an album selected through an artist, choose **Back to albums** to reuse that list and select another release; pressing Enter in the album browser returns to the artist actions. `spoti playlist` can start the selected playlist or browse its tracks across all available pages and play one directly. Non-interactive runs remain display-only and never start playback implicitly.
|
|
184
231
|
|
|
185
232
|
`spoti play <query>` remains shorthand for track playback. The words `track`, `album`, `artist`, and `playlist` are treated as explicit types when followed by another argument. For a track query that starts with one of those reserved words, use `spoti play track <query>` (or quote the complete query as one shell argument). Context commands support `--first` to skip interactive selection.
|
|
186
233
|
|
|
@@ -195,7 +242,7 @@ spoti recent
|
|
|
195
242
|
spoti recent --limit 10
|
|
196
243
|
```
|
|
197
244
|
|
|
198
|
-
`spoti like` and `spoti unlike` operate on the currently playing track. Episodes, advertisements, local files, and unavailable items are ignored safely.
|
|
245
|
+
`spoti like` and `spoti unlike` operate on the currently playing track. Episodes, advertisements, local files, and unavailable items are ignored safely. Artist albums, `spoti playlists`, `spoti liked`, and `spoti recent` use paginated browsers: enter a displayed number to select it, `n` for the next page, `p` for the previous page, or press Enter to go back or leave playback unchanged. Pages are requested only when needed, and previously visited pages are cached for the duration of the command. Short Spotify rate limits are retried automatically with bounded backoff; when `Retry-After` exceeds five seconds, `spoti` exits immediately with a human-readable retry time instead of holding the terminal on a spinner. For collection commands, `--limit` controls the page size from 1 to 50; artist album pages use Spotify’s maximum of 10. Non-interactive runs display only the first page and never start playback implicitly.
|
|
199
246
|
|
|
200
247
|
Check for updates or install the latest npm release:
|
|
201
248
|
|
|
@@ -214,7 +261,7 @@ spoti logout
|
|
|
214
261
|
|
|
215
262
|
When attached to an interactive terminal, `spoti play <query>` asks you to select a result. In non-interactive usage it chooses the first result automatically; `--first` makes that behavior explicit.
|
|
216
263
|
|
|
217
|
-
Watch mode continuously refreshes the current track and progress until `Ctrl+C` is pressed. `--watch` enables it for one command, while `--no-watch` overrides a saved preference. Run `spoti
|
|
264
|
+
Watch mode continuously refreshes the current track and progress until `Ctrl+C` is pressed. `--watch` enables it for one command, while `--no-watch` overrides a saved preference. Run `spoti volume`, `spoti shuffle`, or `spoti repeat` without a value to inspect the current state. Pass a volume value or use `spoti shuffle on|off` or `spoti repeat off|track|context` to change it.
|
|
218
265
|
|
|
219
266
|
|
|
220
267
|
### Command aliases
|
|
@@ -224,9 +271,10 @@ Common aliases include:
|
|
|
224
271
|
```text
|
|
225
272
|
i interactive p play pa pause
|
|
226
273
|
r resume np now q queue s search
|
|
227
|
-
vol volume
|
|
228
|
-
|
|
229
|
-
|
|
274
|
+
vol volume sk seek alb album
|
|
275
|
+
art artist dev device devs devices
|
|
276
|
+
pl playlist pls playlists rep repeat
|
|
277
|
+
rec recent n next prev previous
|
|
230
278
|
```
|
|
231
279
|
|
|
232
280
|
### Shell completions
|
|
@@ -257,6 +305,13 @@ Interactive terminals use restrained styling for names, metadata, headings, and
|
|
|
257
305
|
NO_COLOR=1 spoti now
|
|
258
306
|
```
|
|
259
307
|
|
|
308
|
+
PowerShell:
|
|
309
|
+
|
|
310
|
+
```powershell
|
|
311
|
+
$env:NO_COLOR = "1"
|
|
312
|
+
spoti now
|
|
313
|
+
```
|
|
314
|
+
|
|
260
315
|
Spotify-provided names and descriptions are normalized to safe single-line terminal text before display.
|
|
261
316
|
|
|
262
317
|
## Configuration
|
|
@@ -288,7 +343,7 @@ Available settings:
|
|
|
288
343
|
| `watchAfterPlay` | `false` | Keep `spoti play` open in watch mode after playback starts. |
|
|
289
344
|
| `refreshIntervalMs` | `1000` | Watch refresh interval from `1000` to `30000` milliseconds. |
|
|
290
345
|
|
|
291
|
-
Command flags take precedence over saved configuration. Application preferences are stored in `$XDG_CONFIG_HOME/spoti/config.json`, or `~/.config/spoti/config.json` when `XDG_CONFIG_HOME` is not set.
|
|
346
|
+
Command flags take precedence over saved configuration. Application preferences are stored in `$XDG_CONFIG_HOME/spoti/config.json`, or `~/.config/spoti/config.json` when `XDG_CONFIG_HOME` is not set. This path convention is currently used on Linux, macOS, and Windows; run `spoti config path` to print the exact path for the current system.
|
|
292
347
|
|
|
293
348
|
## Credentials
|
|
294
349
|
|
|
@@ -304,7 +359,7 @@ or, when `XDG_CONFIG_HOME` is not set:
|
|
|
304
359
|
~/.config/spoti/credentials.json
|
|
305
360
|
```
|
|
306
361
|
|
|
307
|
-
|
|
362
|
+
On POSIX systems, the credentials file is created with user-only permissions (`0600`). Access tokens refresh automatically using the environment client ID when present, otherwise the client ID saved by `spoti setup`. Version `0.3.0` adds minimum permissions for private playlist listing, liked-track access, library modification, and recently played tracks. Existing installations will be asked to run `spoti login` once after upgrading. Never provide or store a Spotify client secret in `spoti`.
|
|
308
363
|
|
|
309
364
|
## Spotify API policy
|
|
310
365
|
|
|
@@ -312,6 +367,31 @@ The credentials file is created with user-only permissions (`0600`). Access toke
|
|
|
312
367
|
|
|
313
368
|
Endpoint work must be checked against Spotify's [official OpenAPI specification](https://developer.spotify.com/reference/web-api/open-api-schema.yaml) and [Developer Terms](https://developer.spotify.com/terms).
|
|
314
369
|
|
|
370
|
+
### Spotify quota and rate limits
|
|
371
|
+
|
|
372
|
+
Spotify can return HTTP `429` for two related situations:
|
|
373
|
+
|
|
374
|
+
- a normal short-term rate limit, which can usually be retried after the response's `Retry-After` delay
|
|
375
|
+
- development quota exhaustion, reported by Spotify as `QUOTA_EXCEEDED`, which may have a much longer delay
|
|
376
|
+
|
|
377
|
+
`spoti` automatically retries only bounded waits of five seconds or less. Longer waits exit immediately and show when to try again. Development quota cannot be manually cleared from `spoti`.
|
|
378
|
+
|
|
379
|
+
Spotify development mode currently supports a small allowlist of users and requires the app owner to have Premium. Quota may be shared by development-mode applications owned by the same Spotify developer account, so creating another application under that account is not a reliable way to obtain fresh quota. Extended quota access is subject to Spotify's eligibility and application requirements.
|
|
380
|
+
|
|
381
|
+
Each user should create their own Spotify developer application and save its public client ID:
|
|
382
|
+
|
|
383
|
+
```bash
|
|
384
|
+
spoti setup
|
|
385
|
+
spoti login
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
This avoids putting all public `spoti` users on one developer application's quota. A client ID is public configuration; never provide a client secret to `spoti`.
|
|
389
|
+
|
|
390
|
+
See Spotify's official documentation for current details:
|
|
391
|
+
|
|
392
|
+
- [Rate limits](https://developer.spotify.com/documentation/web-api/concepts/rate-limits)
|
|
393
|
+
- [Quota modes](https://developer.spotify.com/documentation/web-api/concepts/quota-modes)
|
|
394
|
+
|
|
315
395
|
## Development
|
|
316
396
|
|
|
317
397
|
```bash
|
|
@@ -336,4 +416,4 @@ The release workflow attaches the npm package tarball and a `SHA256SUMS` file, a
|
|
|
336
416
|
|
|
337
417
|
## Current scope
|
|
338
418
|
|
|
339
|
-
Version `0.
|
|
419
|
+
Version `0.6.0` adds lazy collection pagination, nested Back navigation, playlist-track selection, current-volume output, new command aliases, visible play-search progress, and bounded rate-limit handling. Development toward `v1.0.0` now includes functional Player, Search, Queue, Devices, and Library TUI screens, shared navigation and keyboard Help, lazy session-cached collection pagination, cancellation-aware requests, and quota-aware error handling.
|
package/dist/app.d.ts
CHANGED
|
@@ -11,9 +11,8 @@ import type { SearchService } from './services/search.service.js';
|
|
|
11
11
|
import { type UpdateService } from './services/update.service.js';
|
|
12
12
|
import { type ConfigStore } from './storage/config.js';
|
|
13
13
|
import { type Output, type OutputStyles } from './ui/output.js';
|
|
14
|
-
import { confirmUpdate, promptSpotifyClientId, selectAlbum, selectAlbumAction, selectArtist, selectArtistAction,
|
|
14
|
+
import { confirmUpdate, promptSpotifyClientId, selectAlbum, selectAlbumAction, selectArtist, selectArtistAction, selectPageAction, selectPlaylist, selectPlaylistAction, selectTrack } from './ui/prompts.js';
|
|
15
15
|
import { type ProgressRunner } from './ui/progress.js';
|
|
16
|
-
import { type InteractiveSearchResult } from './ui/interactive-search.js';
|
|
17
16
|
import { type PlaybackWatcher } from './ui/watch.js';
|
|
18
17
|
export interface AppDependencies {
|
|
19
18
|
auth: AuthService;
|
|
@@ -32,17 +31,16 @@ export interface AppDependencies {
|
|
|
32
31
|
chooseAlbum?: typeof selectAlbum;
|
|
33
32
|
chooseArtist?: typeof selectArtist;
|
|
34
33
|
choosePlaylist?: typeof selectPlaylist;
|
|
35
|
-
|
|
34
|
+
choosePageAction?: typeof selectPageAction;
|
|
36
35
|
chooseAlbumAction?: typeof selectAlbumAction;
|
|
37
36
|
chooseArtistAction?: typeof selectArtistAction;
|
|
38
37
|
choosePlaylistAction?: typeof selectPlaylistAction;
|
|
39
|
-
chooseLikedTrack?: typeof selectLikedTrack;
|
|
40
|
-
chooseRecentTrack?: typeof selectRecentTrack;
|
|
41
38
|
requestSpotifyClientId?: typeof promptSpotifyClientId;
|
|
42
39
|
confirmUpdate?: typeof confirmUpdate;
|
|
43
|
-
interactiveSearch?: () => Promise<InteractiveSearchResult>;
|
|
44
40
|
progress?: ProgressRunner;
|
|
45
41
|
styles?: OutputStyles;
|
|
46
42
|
watchPlayback?: PlaybackWatcher;
|
|
43
|
+
startTui?: () => Promise<void>;
|
|
44
|
+
isInteractive?: boolean;
|
|
47
45
|
}
|
|
48
46
|
export declare function createProgram(dependencies: AppDependencies): Command;
|