this is a big slop that might backfire lol... new config system and UI!

This commit is contained in:
legop3
2026-09-14 02:31:12 -04:00
parent 17b1404157
commit bfdb6555d8
108 changed files with 3212 additions and 701 deletions
@@ -1,7 +1,7 @@
// Operator Command Configuration
// Purpose: Owns transport-neutral command names used by site chat and optional integrations.
// Scope: Prevents Discord configuration from defining whether core server commands can be parsed.
const { loadConfig } = require('../../helpers/configLoader');
const { loadConfig } = require('../../configuration');
function getCommandConfig(config = loadConfig()) {
const commandConfig = config.commands || {};
@@ -0,0 +1,13 @@
// Operator Command Configuration
// Purpose: Defines the shared command prefix and optional bare time-status command.
// Scope: Contains configuration metadata only and never builds command handlers.
const { strictObject, string, nullableString } = require('../../configuration/schemaHelpers');
module.exports = {
key: 'commands',
defaultValue: { prefix: 'rs', timeStatusCommand: 'ts' },
schema: strictObject({
prefix: string({ minLength: 1, maxLength: 20 }),
timeStatusCommand: nullableString({ description: 'Leave empty to disable the bare shortcut.', maxLength: 20 }),
}, { title: 'Commands', required: ['prefix', 'timeStatusCommand'] }),
};
@@ -102,7 +102,7 @@ function createCommandHandlers(deps) {
const mode = getMode();
const commandDefinition = registry[action];
if (commandDefinition?.requiredFeature && !deps.isFeatureEnabled(commandDefinition.requiredFeature)) {
await request.reply({ content: `${commandDefinition.unavailableLabel || commandDefinition.requiredFeature} feature is not configured.` });
await request.reply({ content: `${commandDefinition.unavailableLabel || commandDefinition.requiredFeature} feature is disabled.` });
return;
}
// Actions in this set can change operational safety or access policy, so
@@ -127,7 +127,7 @@ test('status and help survive lockdown', async () => {
test('a disabled required feature is reported before any permission check', async () => {
const run = createRouter({ featureEnabled: false });
assert.match(await run('rs lights on', nonAdmin), /Home Assistant feature is not configured/);
assert.match(await run('rs lights on', nonAdmin), /Home Assistant feature is disabled/);
});
test('green mode remains available without optional Home Assistant features', async () => {