fix: nonfatal missing key commands (resolves #6397)j#6398
fix: nonfatal missing key commands (resolves #6397)j#6398ariane-emory wants to merge 51 commits into
Conversation
|
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 Alright, I'll look into how that could work and see what I can come up with. |
a17f3a8 to
69ab87a
Compare
- Change Keybinds schema from .strict() to .passthrough() to allow unknown keys - Add ValidKeybindNames set for validating keybind names - Add Config.Warning schema and Config.warnings() function - Add GET /config/warnings endpoint to fetch warnings - Add warning toast display in TUI when sync completes - Add tests for warning generation with unknown keybind names Fixes anomalyco#6397
When user presses a key that matches a keybind configured for an unknown command name, show a warning toast with the command name.
- Fetch unknown keybinds from /config/warnings endpoint instead of iterating all keybinds in config - Add keybinds array field to Warning schema to provide list of unknown keybind names - Fix TypeScript error from passthrough schema by casting value - Regenerate SDK with ConfigWarning.keybinds field
69ab87a to
18b74aa
Compare
…approach - Pre-process unknown keybinds before Zod validation (keep .strict() schema) - Store unknown keybinds with name+binding in warnings - Update TUI to parse and match unknown keybinds directly - Remove unused BusEvent for warnings - Update tests to verify new warning structure - Regenerate TypeScript SDK (KeybindsConfig without index signature) Resolves anomalyco#6397
The null check was added during earlier iterations when .passthrough() was used in the keybind schema. With the current pre-processing approach that strips unknown keybinds and maintains .strict(), all keybind values have defaults applied and will never be undefined, making this check unnecessary.
- Add Config.Event.Warning BusEvent definition - Server sends warning events to clients on SSE connect - TUI subscribes to config.warning events instead of polling API - Remove /config/warnings API endpoint (no longer needed) - Regenerate SDK This fulfills the maintainer's request to use event-based communication for config warnings rather than TUI-side enforcement.
|
@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?
Whaddya think? If there are further refinements you'd like. don't hesitate to ask! |
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
9d5a565 to
7cd5bd0
Compare
6afde5d to
7cd5bd0
Compare
|
Requires further testing/revision after significant recent changes in dev, re-drafting until that's been done. |
Resolved conflict in dialog-command.tsx by preserving the unknown keybind handling logic from fix/nonfatal-missing-key-commands while incorporating the entries memoization changes from dev.
Resolved conflicts: - Combined Flag.OPENCODE_DISABLE_PROJECT_CONFIG check from dev with unknownKeybinds collection from current branch in config.ts
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.