This commit is contained in:
legop3
2026-08-09 00:13:38 -04:00
parent 70f71b2d1e
commit 0083c887f4
3 changed files with 19 additions and 3 deletions
@@ -130,6 +130,11 @@ test('a disabled required feature is reported before any permission check', asyn
assert.match(await run('rs lights on', nonAdmin), /Home Assistant feature is not configured/);
});
test('green mode remains available without optional Home Assistant features', async () => {
const run = createRouter({ featureEnabled: false });
assert.match(await run('rs green on', admin), /Green mode enabled/);
});
test('ordinary words that merely start with the prefix are not commands', async () => {
const run = createRouter();
assert.equal(await run('rsvp', nonAdmin), '');
@@ -19,7 +19,10 @@ function buildCommandRegistry(prefix, timeCommand) {
mode: { category: 'admin', summary: 'Change the server mode.', usage: [`${prefix} mode <open|turns|admin|lockdown>`], access: 'Admin', permission: 'admin' },
reason: { category: 'admin', summary: 'Show, set, or clear the admin-mode reason.', usage: [`${prefix} reason [text|clear]`], access: 'Admin to change' },
goal: { category: 'admin', summary: 'Show, set, or clear the global objective.', usage: [`${prefix} goal [text|clear]`], access: 'Admin to change' },
green: { category: 'admin', summary: 'Toggle green room and page mode.', usage: [`${prefix} green <on|off>`], access: 'Admin', permission: 'admin', requiredFeature: 'homeAssistant', unavailableLabel: 'Home Assistant' },
// Green mode is fundamentally a server theme. Home Assistant lighting is
// an optional enhancement, so the command must remain available when that
// integration is absent.
green: { category: 'admin', summary: 'Toggle green room and page mode.', usage: [`${prefix} green <on|off>`], access: 'Admin', permission: 'admin' },
lights: {
category: 'features',
summary: 'Control room lights or manage the admin light lock.',