For tinkerers
Write a plugin for Cove
Two files of plain JavaScript. No build step, no SDK to install, no account. If you can write a function, you can write a Cove plugin.
Two files, that’s it
A folder with a plugin.json and a module that exports activate(). This one counts your games:
Try it
- In Cove, open Settings → Plugins and choose Install plugin.
- Enter the folder the
plugin.jsonis in. - Cove shows what the plugin asks for. Allow it, and it runs.
Or put the folder into Cove’s plugin folder (Open plugin folder). It then sits there as “Waiting for your approval” until you say yes.
{
"id": "my-plugin",
"name": "My plugin",
"version": "1.0.0",
"author": "You",
"description": "Counts my games.",
"apiVersion": 1,
"permissions": ["library.read", "ui.notify"],
"entry": "index.js"
}export async function activate(cove) {
const games = await cove.library.list();
await cove.ui.notify(`You have ${games.length} games.`);
}What a plugin may do
Each plugin lists what it needs, and you see that list before anything runs. Ask only for what you use. If an update wants more, the plugin pauses until it’s approved again.
library.read- Read the library: titles, genres, playtime, install state. No file paths.
library.add- Add games, with a title and optionally a program to start.
catalog.search- Search the catalogue, up to 20 results per search.
achievements.define- Define its own achievements with Cove’s rules: hours played, games in the library, playing at certain hours, recommendations tried. Up to 50.
ui.addSidebarItem- Add up to three entries to the sidebar, optionally with a file picker for text files up to 5 MB.
ui.notify- Show a small notice, at most three every ten seconds. Nobody likes a chatty plugin.
storage- Keep its own data as JSON, 1 MB in total. Other plugins can’t read it.
The fence
Locked in, on purpose.
- Every plugin runs in its own Web Worker. No page to change, no access to Cove’s insides.
- No internet.
fetch, WebSockets and the like are removed before the plugin loads, and Cove’s content security policy blocks the rest. - A plugin can load its own files and nothing else: no files of other plugins, no code from the web.
- Every call is checked against the permissions you approved. Storage, achievements and new games are checked a second time in Cove’s core.
Three to start from
They live in the repository, each with tests. Copy one and change it. (Their texts are German, the code isn’t.)
playtime-goalsAchievements for 5, 25, 100, 250 and 500 hours played in Cove.
Permissions:
achievements.definerandom-pickA sidebar entry that suggests an installed game. Games you haven’t touched in a while get a slightly better chance, and it never picks the same one twice in a row.
Permissions:
library.read,ui.addSidebarItem,ui.notify,storagecsv-importImports games from a CSV file you pick from the sidebar.
Permissions:
library.add,ui.addSidebarItem,ui.notify
Testing without Cove
A plugin is just a module, so node --test works with a fake cove object. No app, no window:
import assert from "node:assert/strict";
import { test } from "node:test";
import { activate } from "./index.js";
test("counts the games", async () => {
const notes = [];
await activate({
library: { list: async () => [{ id: "a" }, { id: "b" }] },
ui: { notify: async (msg) => { notes.push(msg); } },
});
assert.deepEqual(notes, ["You have 2 games."]);
});The whole story
Every manifest field, every rule and the complete API are in the plugin guide. Missing a permission for your idea? Tell me in an issue.