opencode icon indicating copy to clipboard operation
opencode copied to clipboard

fix: nonfatal missing key commands (resolves #6397)j

Open ariane-emory opened this issue 3 months ago • 5 comments

This PR changes the behaviour so that binding missing key commands in a user's config is not a fatal error that prevents the startup of opencode entirely.

With this PR, keybindings for non-existent keywords, when struck will instead display a toast saying "No command 'the_fake_command_name'".

Resolves #6397.

ariane-emory avatar Dec 29 '25 21:12 ariane-emory

this shouldn't be enforced on the tui side, I would expect the tui to always be fed a valid config, and maybe u can introduce a config event for warnings that you emit that the tui could display

rekram1-node avatar Dec 30 '25 05:12 rekram1-node

@rekram1-node Alright, I'll look into how that could work and see what I can come up with.

ariane-emory avatar Dec 30 '25 06:12 ariane-emory

@rekram1-node Well.... it turned out to be a lot trickier to do than I thought it would, but after a few rerolls this does seem to be doing it in the way that you'd requested?

  • strips the 'unknown' key commands out prior to validation, so the config always receives a valid config.
  • -emits a config.warning BusEvent that TUI then consumes and reacts to by displaying a warning like Unknown key commands: foo, bar.
  • retains the Unknown key command: foo toast upon striking one of these keys.

Whaddya think? If there are further refinements you'd like. don't hesitate to ask!

ariane-emory avatar Jan 01 '26 01:01 ariane-emory

Hey! Your PR title Fix: nonfatal missing key commands (resolves #6397) doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

github-actions[bot] avatar Jan 08 '26 22:01 github-actions[bot]

Requires further testing/revision after significant recent changes in dev, re-drafting until that's been done.

ariane-emory avatar Jan 11 '26 22:01 ariane-emory