Plugin rules
Every Volumio plugin follows these rules. Each rule names the check that enforces it. Checks whose id starts with G1, G2 or G3 run in volumio-plugin check and on every pull request. The others belong to gates that do not run yet, so a moderator checks those rules in review. From pull request to store describes the gates.
Draft
These rules are a draft. Tell us what is wrong, missing or unclear in the Plugins forum.
Principles
Every rule comes from one of these principles.
| Principle | What it means |
|---|---|
| One plugin per function | A device never runs two plugins that do the same job. When a plugin for your function exists, improve it. Volumio does not enforce this rule yet. |
| Propose before you build | A new plugin starts with a short proposal in the forum: what it does, its function, the services it calls. You can build while the proposal is discussed. |
| Volumio stays up | A plugin never crashes Volumio, even when its service stops working or the network is not ready. It reports the error, retries when the network is back, and stops cleanly. |
| Only add, never modify | A plugin adds files and packages of its own. It never changes what ships in the Volumio image, nor another plugin's files. Uninstall removes exactly what install added. |
| Everything in the package | Dependencies ship inside the plugin, built for each architecture. System packages come only from APT. |
| Declare what you do | Every host, system package, service, file outside the plugin folder and permission is listed in volumio-plugin.json. |
| Built by Volumio | The package users install is built by Volumio's CI from your pull request. Installing by hand or over SSH is for development only. |
| Checks, not opinions | Every rule has a check that says how to fix it. A plugin cannot switch a check off. |
| Plain for users | Every text the user sees is translatable, with English first. Settings use Volumio's settings page. |
Manifest
| Rule | Check | Runs today |
|---|---|---|
The plugin has a volumio-plugin.json that matches the schema, with no other fields | G1.schema | Yes |
function is an entry of the function registry. A function outside it is a warning | G1.function | Yes |
engines.volumio is a semver range, and engines.api is "1" | G1.engines, G1.schema | Yes |
package.json sets no name, version or volumio_info. The build writes them from the manifest | G1.package-json | Yes |
| The plugin has a README and a LICENSE file | G1.file.readme, G1.file.license | Yes |
The built package has main set to index.js, and an i18n/strings_en.json | G1.main, G1.file.i18n | Yes |
Every host the plugin connects to, streams included, is listed in network | G4 | No |
version (semver) goes up with each release | Review | Yes |
Code
| Rule | Check | Runs today |
|---|---|---|
Log with this.logger, never console.log | G2.js.console-log | Yes |
Run a program with execFile or spawn and its arguments as a list. No exec, no shell: true. A value from the settings never reaches a shell | G2.js.shell | Yes |
No blocking calls: no execSync, execFileSync or spawnSync, no synchronous network calls. They freeze playback and the UI | G2.js.sync-exec; network calls: G8 | Yes |
No process.exit, and no process-wide uncaughtException or unhandledRejection handlers | G2.js.process-exit, G2.js.global-handler | Yes |
Never replace a Volumio method (this.commandRouter.something = ...) | G2.js.command-router-override | Yes |
| No private key or service token in any file. A key the service needs is typed by the user in the settings | G2.secret | Yes |
Inline eslint-disable comments, # shellcheck disable directives and .shellcheckrc are ignored | All gates | Yes |
A long-running program runs as a systemd unit the plugin declares in system.services, never as a child process of the plugin | G8 | No |
No password piped into sudo (echo volumio | sudo -S) | G8 | No |
install.sh
| Rule | Check | Runs today |
|---|---|---|
POSIX sh, because Volumio runs it with dash: set -e, no pipefail, no || true, no ShellCheck warnings | G2.shell.*, G2.shellcheck.* | Yes |
System packages only as apt-get install -y <package>, each named in full and listed in system.apt. No npm, pip, dpkg or local .deb | G2.shell.package-manager | Yes |
Every download is checked with sha256sum -c | G2.shell.download | Yes |
| Never write a sudoers rule | G2.shell.sudoers | Yes |
Never change, overwrite or remove a file or package that ships in the Volumio image (/boot, /etc/asound.conf, mpd.conf and the like), nor another plugin's files | G4 | No |
| Uninstall removes exactly what install added, and nothing else | G4 | No |
Dependencies
| Rule | Check | Runs today |
|---|---|---|
package-lock.json is committed | G3.lockfile | Yes |
No high or critical npm audit advisory in the production dependencies | G2.audit | Yes |
| Every production dependency has a licence. GPL-family and unknown licences are flagged | G2.licence.* | Yes |
Dependencies ship inside the package. Native modules are built for every architecture in arch | G3.native-arch | Yes |
| Nothing is downloaded at runtime without a pinned version and a checksum | G4, G8 | No |
Plugin API
| Rule | Check | Runs today |
|---|---|---|
Every method Volumio calls returns a kew promise: no async method, no native Promise | G7 | No |
onVolumioStart and onStart resolve within seconds and do long work afterwards. At boot Volumio waits 30 seconds for all plugins | G5 | No |
The plugin acts only between onStart and onStop. onStop releases everything: timers, sockets, child processes, Browse entries | G5 | No |
Call only the command router methods the plugin API lists, and never require Volumio's own files | G8 | No |
| Every text the user sees is an i18n key, with English always present. No placeholder title, description or README | G8 | No |
A music_service's URIs start with music_service/<id>. search never rejects and puts a time limit on each request | G7 | No |
| The plugin does not depend on the network being ready at start. A login retries when the network is back | G5 | No |
Audio
| Rule | Check | Runs today |
|---|---|---|
| A plugin that changes the audio path passes Volumio's audio test with Fusion DSP on, in every audio format | G6 | No |
| A plugin that shows a spectrum or a VU meter uses Volumio's analyzer module, once Volumio publishes it | Review | No |
Behaviour on a device
| Rule | Check | Runs today |
|---|---|---|
| Installing the plugin changes on the device only what the manifest declares: packages, files, services, hosts | G4 | No |
| The plugin survives a lost network or a service that stops answering, without taking Volumio down. No process is left after stop | G5 | No |
| An audio plugin plays audio correctly | G6 | No |
| The plugin installs, plays, updates and uninstalls on each Volumio product family | G7 | No |
| The plugin reaches the quality score for its code, error handling, settings page, network use and disk use | G8 | No |
Publishing
| Rule | Check | Runs today |
|---|---|---|
| Every release goes through a pull request to the sources repository. Volumio's CI builds it and Volumio publishes it | CI | No |
| A plugin that needs an account or a token comes with test credentials, sent privately | Review | Yes |
Plugins already in the store
A plugin published before these rules gets warnings, not errors, for the problems it had when the rules arrived. Any new problem is an error. A plugin with only a package.json gets warnings where a plugin with volumio-plugin.json gets errors.
Related
- Troubleshooting explains each finding and its fix.
- The AI prompt gives these rules to a coding agent.