Repository navigation
feat(mecatui): split client keymap settings into ~/.config/mecatui/settings.yaml - #481
Merged
Merged
Conversation
…ttings.yaml Issue #459: mecatui and mecated shared one operator settings file (~/.config/mecatl/settings.yaml) whose schema is server-owned and parsed strictly, while mecatui read its single keymap: key out of the same file via a separate lenient decoder the server silently dropped — the early "git regret model" (one config namespace read by two binaries, scope invisible from the file). Give mecatui its own client-owned settings file at ~/.config/mecatui/settings.yaml (the XDG config tree, matching the existing mecatui/themes dir). v1 moves only keymap: — the one key with an existing decoder and users (#455/#460/#467); the strict top-level clientSettings schema is designed to grow additive fields (theme, UI behaviour) as small follow-ups without re-designing. - New file parses STRICTLY (yaml.NewDecoder + KnownFields(true), the daemonconfig idiom): an unknown top-level key or a multi-document file is a startup error naming the file; raw YAML syntax errors are not wrapped through (CWE-209 — they embed the offending source line). - The legacy server file stays LENIENT (plain Unmarshal tolerates the server's permissions:/guardrails:/models: siblings) for back-compat: an operator's existing keymap: keeps working. - Precedence, per action (a higher layer rebinds only the actions it names): CLI --keymap > client file > legacy server file. No env form for keymap exists, so the chain is three layers. - A legacy keymap: fires a one-line stderr deprecation WARN at startup (pre-alt-screen, direct write not slog) pointing at the new home. - The legacy parser now applies the same TypeError-vs-syntax split as the strict reader so a wrong-typed keymap: value no longer leaks a truncated slice of the offending value into the returned error (CWE-209; flagged by the panel's security axis and pinned by a regression test). Docs: docs/tui.md "Remapping keys" and user-docs/what-you-get/mecatui.md now name the client file as primary, document the three-layer precedence, and note the legacy deprecation. Server-scoped docs/configuration-reference.md and the configgen skeleton are untouched (the server schema is unchanged; configref regen is a no-op). llms.txt regen is a no-op (index only). Deferred (out of scope, per the issue): theme/UI-flag/env-knob settings layer, a client configgen reference generator (until a second key lands), a MECATUI_KEYMAP env form, the typed client->server spawn payload, and #456 live-reload. Verification: task lint (0 issues), task test (full suite, -race), go run ./cmd/mecademo (full offline session), task site:build, task docs:check (0 broken links). 14 new offline tests cover path resolution, strict/lenient decode, precedence, per-action merge, legacy-only back-compat (merged map equals the pre-split two-layer output), the deprecation WARN firing exactly once, and the CWE-209 no-leak regression. Closes #459 Co-Authored-By: mecatl <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Splits the mecatui client
keymap:setting out of the server's shared~/.config/mecatl/settings.yamlinto a client-owned~/.config/mecatui/settings.yaml. Closes #459.The shared file's schema is server-owned (permconfig, parsed strictly) and its generated reference reflects only the server schema, while mecatui read its single
keymap:key out of the same file via a separate lenient decoder the server silently dropped — the early "git regret model" (one config namespace read by two binaries, scope invisible from the file).What changes
~/.config/mecatui/settings.yaml(the XDG config tree, matching the existingmecatui/themes/dir). v1 moves onlykeymap:— the one key with an existing decoder and users (docs: mecatui keybindings are configurable but undocumented #455/docs+fix(mecatui): document keymap overrides, live help-overlay bindings, isolate user-config test reads #460/fix(mecatui): render live keymap affordances #467). The strict top-levelclientSettingsschema is designed to grow additive fields (theme, UI behaviour) as small follow-ups without re-designing.yaml.NewDecoder+KnownFields(true), the daemonconfig idiom): an unknown top-level key or a multi-document file is a startup error naming the file; raw YAML syntax errors are not wrapped through (CWE-209).Unmarshaltolerates the server'spermissions:/guardrails:/models:siblings) for back-compat — an operator's existingkeymap:keeps working.--keymap> client file > legacy server file. No env form for keymap exists, so the chain is three layers.keymap:fires a one-line stderr deprecation WARN at startup (pre-alt-screen, direct write not slog) pointing at the new home.keymap:value no longer leaks a truncated slice of the offending value into the returned error (CWE-209; pinned by a regression test).Docs
docs/tui.md"Remapping keys" anduser-docs/what-you-get/mecatui.mdnow name the client file as primary, document the three-layer precedence, and note the legacy deprecation. Server-scopeddocs/configuration-reference.mdand the configgen skeleton are untouched (server schema unchanged; configref regen is a no-op).llms.txtregen is a no-op (index only).Out of scope (per the issue)
Theme/UI-flag/env-knob settings layer, a client configgen reference generator (until a second key lands), a
MECATUI_KEYMAPenv form, the typed client→server spawn payload, and #456 live-reload.Verification
task lint— 0 issuestask test— full suite green (-race, root + engine + standalone hygiene)go run ./cmd/mecademo— full offline sessiontask site:build— user-docs build greentask docs:check— 0 broken links/anchors/orphansReviewed via the dev-pipeline panel (Spec / Standards / Domain: security, architecture, library-reuse, duplication); the three confirmed findings were fixed before this PR.
🤖 Generated with mecatl