diff --git a/package.json b/package.json index f013f19..6db3eba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "opencode-sidepulse", - "version": "0.1.6", + "version": "0.1.7", "description": "Show opencode agent status on a SidePulse Pro or SidePulse Dot LED device.", "keywords": [ "opencode", diff --git a/plugin.mjs b/plugin.mjs index ee5691c..0375857 100644 --- a/plugin.mjs +++ b/plugin.mjs @@ -33,13 +33,16 @@ const PROGRAMS = { done: "#00ff22 0.6s cosine\n", } -// Volume names differ by model (SidePulse, SidePulsePro, SidePulseDot), so match the -// prefix and confirm the control file exists. +// Volume names differ by model (SidePulse, SidePulsePro, PulseDot), so match the prefix +// and confirm the control file exists. The Dot is FAT12, and its 11-character label limit +// rules out "SidePulseDot". +const VOLUME = /^(sidepulse|pulsedot)/i + function mount() { try { for (const name of readdirSync("/Volumes")) { const dir = join("/Volumes", name) - if (/^sidepulse/i.test(name) && existsSync(join(dir, "LEDS.LED"))) return dir + if (VOLUME.test(name) && existsSync(join(dir, "LEDS.LED"))) return dir } } catch {} return undefined @@ -383,6 +386,11 @@ if (selfCheck) { } } + for (const name of ["SidePulse", "SidePulsePro", "PulseDot"]) { + if (!VOLUME.test(name)) throw new Error(`volume ${name} does not match ${VOLUME}`) + } + if (VOLUME.test("Macintosh HD")) throw new Error(`volume Macintosh HD matches ${VOLUME}`) + console.log(`ok: ${Object.keys(PROGRAMS).length} programs, ${want.length} transitions`) console.log(` device ${mount() ?? "not mounted"}`) console.log(` app socket ${socket() ?? "absent, using direct mode"}`)