Skip to content

Add music-assistant-controls extension#21249

Merged
raycastbot merged 6 commits intoraycast:mainfrom
YoeriVD:ext/music-assistant-controls
Sep 3, 2025
Merged

Add music-assistant-controls extension#21249
raycastbot merged 6 commits intoraycast:mainfrom
YoeriVD:ext/music-assistant-controls

Conversation

@YoeriVD
Copy link
Contributor

@YoeriVD YoeriVD commented Aug 29, 2025

Description

This extension lets you control Music Assistant (stand-alone server or Home-Assistant add-on) straight from Raycast and shows the current track in the macOS menu bar.

Command What it does
Toggle Pauses/resumes playback on the selected player
Next / Previous Skips tracks
Menu Bar Player Displays title - artist in the macOS menu bar
Set Active Player Chooses what player to run other commands on

Why it’s useful

  • Keeps your hands on the keyboard—no browser tab or HA dashboard needed.
  • Works with multiple players and sources supported by Music Assistant (Spotify, Tidal, local files…).

Dependencies

  • Music Assistant listening on ws://HOST:8095/ws
    (for HA users: expose 8095 in the add-on’s settings)

No extra API tokens required.

Credits

Inspired by Matti S’s Spotify Player extension.

Screencast

screenshot-commands screenshot-menu-bar

Checklist

- v2 (#8)
- fix(deps): update dependency @raycast/api to v1.102.6 (#35)
- chore(deps): update dependency @types/react to v19.1.12 (#34)
- chore(deps): update dependency @types/node to v22.18.0 (#33)
- chore(deps): update dependency eslint to v9.34.0 (#32)
- chore(deps): update dependency @types/react to v19.1.11 (#31)
- fix(deps): update dependency @raycast/api to v1.102.5 (#30)
- chore(deps): update dependency @types/node to v22.17.2 (#29)
- fix(deps): update dependency @raycast/api to v1.102.4 (#28)
- chore(deps): update dependency @types/react to v19.1.10 (#27)
- chore(deps): update dependency eslint to v9.33.0 (#24)
- chore(deps): update dependency @types/node to v22.17.1 (#23)
- fix(deps): update dependency @raycast/api to v1.102.3 (#22)
- chore(deps): update dependency @types/react to v19.1.9 (#19)
- chore(deps): update dependency typescript to v5.9.2 (#21)
- chore(deps): update dependency @types/node to v22.17.0 (#20)
- chore(deps): update dependency eslint to v9.32.0 (#18)
- chore(deps): update dependency @types/node to v22.16.5 (#17)
- fix(deps): update dependency @raycast/api to v1.101.1 (#16)
- fix(deps): update dependency @raycast/api to v1.101.0 (#15)
- chore(deps): update dependency @types/node to v22.16.4 (#14)
- chore(deps): update dependency eslint to v9.31.0 (#13)
- chore(deps): update dependency @types/node to v22.16.3 (#12)
- chore(deps): update dependency @types/node to v22.16.2 (#11)
- chore(deps): update dependency @types/node to v22.16.1 (#10)
- chore(deps): update dependency @types/node to v22.16.0 (#3)
- chore(deps): update dependency @types/react to v19.1.8 (#5)
- chore(deps): update dependency eslint to v9.30.1 (#6)
- chore(deps): update dependency prettier to v3.6.2 (#2)
- Create node.js.yml
- refactor: update renovate configuration to include package rules for minor and patch updates
- Merge pull request #1 from YoeriVD/renovate/configure
- Add renovate.json
@raycastbot raycastbot added the new extension Label for PRs with new extensions label Aug 29, 2025
@raycastbot
Copy link
Collaborator

raycastbot commented Aug 29, 2025

Congratulations on your new Raycast extension! 🚀

You can expect an initial review within five business days.

Once the PR is approved and merged, the extension will be available on our Store.

@YoeriVD
Copy link
Contributor Author

YoeriVD commented Aug 29, 2025

New and improved version of #20087

@YoeriVD YoeriVD marked this pull request as ready for review August 29, 2025 15:29
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Summary

This PR introduces a new music-assistant-controls extension that allows users to control Music Assistant (a multi-room audio server or Home Assistant add-on) directly from Raycast. The extension provides several key features:

Core Functionality:

  • Player Controls: No-view commands for play/pause and next track navigation
  • Menu Bar Integration: Displays currently playing track information with 10-second refresh intervals
  • Dynamic Player Selection: Users can choose which Music Assistant player to control from a list of active players
  • WebSocket Communication: Connects to Music Assistant via WebSocket on port 8095

Architecture & Integration:
The extension follows established Raycast patterns similar to other music control extensions like Spotify Player. It uses a clean client-server architecture with:

  • MusicAssistantClient class that abstracts API interactions and UI state management
  • executeApiCommand wrapper function for proper WebSocket connection handling and cleanup
  • Local storage persistence for selected player preferences
  • Comprehensive error handling with user-friendly toast notifications

External Code Integration:
The extension includes adapted TypeScript interfaces and API client code from the upstream Music Assistant frontend project (located in src/external-code/), ensuring compatibility with the existing Music Assistant ecosystem while maintaining type safety.

Testing & Quality:
The extension demonstrates strong engineering practices with comprehensive Jest test coverage, proper TypeScript configuration, and follows Raycast's formatting standards.

Important Files Changed

Click to expand file ratings table
Filename Score Overview
extensions/music-assistant-controls/package.json 4/5 Main extension configuration with menu bar mode, no-view commands, and WebSocket dependencies
extensions/music-assistant-controls/src/music-assistant-client.ts 5/5 Comprehensive client class with excellent documentation and error handling
extensions/music-assistant-controls/src/external-code/music-assistant-api.ts 5/5 Large external API wrapper adapted from upstream Music Assistant project
extensions/music-assistant-controls/src/external-code/interfaces.ts 5/5 Extensive TypeScript type definitions for Music Assistant API structures
extensions/music-assistant-controls/src/api-command.ts 4/5 WebSocket connection wrapper with proper error handling and resource cleanup
extensions/music-assistant-controls/src/menu-bar.tsx 4/5 Menu bar component displaying current tracks and player controls
extensions/music-assistant-controls/src/set-active-player.tsx 4/5 Player selection interface with dynamic queue listing
extensions/music-assistant-controls/src/use-selected-player-id.ts 4/5 Local storage utilities for player selection with error handling
extensions/music-assistant-controls/src/next-song.tsx 5/5 Simple no-view command for skipping tracks
extensions/music-assistant-controls/src/preferences.ts 5/5 Clean TypeScript interface for extension preferences
extensions/music-assistant-controls/CHANGELOG.md 3/5 Changelog with correct format but confusing version structure for initial extension
extensions/music-assistant-controls/tests/ (all test files) 5/5 Comprehensive test suite with excellent coverage and mocking patterns
extensions/music-assistant-controls/.prettierrc 5/5 Standard Raycast formatting configuration
extensions/music-assistant-controls/tsconfig.json 4/5 TypeScript configuration using ES2023 target (newer than typical)
extensions/music-assistant-controls/.gitignore 5/5 Standard ignore file following Raycast conventions
extensions/music-assistant-controls/jest.config.js 5/5 Comprehensive Jest configuration with proper test setup
extensions/music-assistant-controls/renovate.json 5/5 Dependency management configuration with automerge for stable versions

Confidence score: 4/5

  • This PR is generally safe to merge with well-structured code and comprehensive testing
  • Score reflects solid architecture and testing practices, with minor concerns about CHANGELOG structure and ECMAScript target version choice
  • Pay attention to the CHANGELOG.md file which describes multiple versions for what appears to be an initial extension submission

23 files reviewed, 6 comments

Edit Code Review Bot Settings | Greptile

Copy link
Collaborator

@pernielsentikaer pernielsentikaer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add at least one screenshot of the extension and add them to a folder called metadata - you need to use our tool to get the right padding on the images

@YoeriVD
Copy link
Contributor Author

YoeriVD commented Sep 1, 2025

Hi @pernielsentikaer

Is that the only thing preventing this PR from merging or do you have other feedback as well?

Copy link
Collaborator

@pernielsentikaer pernielsentikaer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile feedback and metadata images should be the last 😊

@YoeriVD
Copy link
Contributor Author

YoeriVD commented Sep 2, 2025

Brilliant, that is good news!

The Greptile feedback is straightforward, I'll process that as soon as I have a moment.

In case of the screenshots, I am a bit confused.
There are two screenshots in the metadata folder. In fact I reused them in de description of this pull request. Did you miss those?

@pernielsentikaer
Copy link
Collaborator

Could you add at least one metadata of the extension and add them to a folder called metadata - you need to use our tool to get the right padding on the images

@pernielsentikaer
Copy link
Collaborator

It has the wrong format 😊

@YoeriVD
Copy link
Contributor Author

YoeriVD commented Sep 2, 2025

@pernielsentikaer done!

…new image location. Enhance error handling in use-selected-player-id.ts by adding failure toast notifications for command launch failures.
Copy link
Collaborator

@pernielsentikaer pernielsentikaer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi 👋

Looks good to me, approved 🔥

@raycastbot raycastbot merged commit 31fa55a into raycast:main Sep 3, 2025
2 checks passed
@github-actions
Copy link
Contributor

github-actions bot commented Sep 3, 2025

Published to the Raycast Store:
https://raycast.com/yoerivd/music-assistant-controls

@raycastbot
Copy link
Collaborator

🎉 🎉 🎉

We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag.

@YoeriVD YoeriVD deleted the ext/music-assistant-controls branch September 3, 2025 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new extension Label for PRs with new extensions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants