Skip to content

feat(website): Include local commands in generated HTML - #287

Merged
agessaman merged 5 commits into
agessaman:devfrom
hickey:feat/generate-local-cmds
Sep 20, 2026
Merged

agessaman merged 5 commits into
agessaman:devfrom
hickey:feat/generate-local-cmds

Conversation

@hickey

@hickey hickey commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

This updates the generate_website.py command with 2 features:

  • Include local commands in the generated HTML file
  • Exclude commands that have been disabled in the configuration file

Why

This allows more accurate list of commands for an installation.

Testing

Generated HTML locally and verified output.

Checklist

  • Branched from dev and targeting dev
  • make test passes
  • make lint passes (ruff + mypy)
  • Frontend lint passes if templates changed (npm run lint:frontend)
  • Tests added or updated for behavior changes
  • CHANGELOG.md updated under ## [Unreleased] if user-visible
  • Config changes are reflected in config.ini.example (and the minimal/quickstart
    templates where relevant) — CI validates these with validate_config.py --strict
  • New docs pages are added to nav: in mkdocs.yml
  • Any new command justifies its airtime and defaults conservatively

Signed-off-by: Gerard Hickey <hickey@kinetic-compute.com>
Signed-off-by: Gerard Hickey <hickey@kinetic-compute.com>
Signed-off-by: Gerard Hickey <hickey@kinetic-compute.com>
@hickey hickey changed the title Feat/generate local cmds feat(website): Include local commands in generated HTML Sep 17, 2026
The generated page is meant to list what the bot actually answers, so it
has to read the config the same way the bot does. Three places where it
did not:

The local `config.ini` overlay was never read. `read_config` parsed only
the base file, while the bot overlays `<local_dir_path>/config.ini` on
top of it, and that overlay is exactly where the web viewer saves a local
plugin's settings. A local command disabled from the settings page still
showed up on the site.

`is_command_enabled` derived the section name and the legacy `enabled`
spellings by hand, duplicating `BaseCommand._derive_config_section_name`
and guessing that a legacy key lives in the command's own section. Half
of them do not: `[Jokes] joke_enabled` disables `Joke_Command`. It now
calls `command_section_name` and `read_enabled`, which share the alias
table with the runtime and the settings UI.

That table was missing the same-section `[Joke_Command] joke_enabled` and
`[DadJoke_Command] dadjoke_enabled` spellings, which both commands accept
through their own fallback. The settings page read only the `[Jokes]`
form, so a bot disabled the same-section way displayed as enabled.

Also fold the duplicated local-commands-dir resolution into
`resolve_local_commands_dir`, take `bot_root` as a `MinimalBot` argument
instead of assigning it post-construction twice, and restore the `hidden`
attribute check that `generate_samples` lost when it moved to
`filter_commands`.
@agessaman

Copy link
Copy Markdown
Owner

Thanks for this — both features are genuinely useful, and the local-commands support fills a real gap.

I merged dev and pushed a follow-up. The main thing: the generated page now reads the <local_dir_path>/config.ini overlay the way the bot does, since that is where the settings UI saves a local plugin's state — without it a locally disabled command still showed up. I also routed the enabled check through command_section_name and read_enabled so it shares the legacy-alias table with the runtime ([Jokes] joke_enabled disables joke, which the hand-rolled version missed), added the two same-section joke spellings that table was missing, folded the duplicated local-dir lookup into a helper, and added tests and a docs section.

Merging now.

@agessaman
agessaman merged commit af05c2e into agessaman:dev Sep 20, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants