Skip to content

feat(mecatui): split client keymap settings into ~/.config/mecatui/settings.yaml - #481

Merged
jbeda merged 1 commit into
mainfrom
issue-459-mecatui-settings
Aug 12, 2026
Merged

jbeda merged 1 commit into
mainfrom
issue-459-mecatui-settings

Conversation

@jbeda

@jbeda jbeda commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Splits the mecatui client keymap: setting out of the server's shared ~/.config/mecatl/settings.yaml into 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

  • New 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 (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-level clientSettings schema is designed to grow additive fields (theme, UI behaviour) as small follow-ups without re-designing.
  • Strict new file (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).
  • 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.
  • Security (panel-review find): 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; 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 (server schema unchanged; configref regen is a no-op). llms.txt regen 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_KEYMAP env form, the typed client→server spawn payload, and #456 live-reload.

Verification

  • task lint — 0 issues
  • task test — full suite green (-race, root + engine + standalone hygiene)
  • go run ./cmd/mecademo — full offline session
  • task site:build — user-docs build green
  • task docs:check — 0 broken links/anchors/orphans
  • 14 new offline tests (path resolution, strict/lenient decode, precedence, per-action merge, legacy-only back-compat, deprecation WARN exactly-once, CWE-209 no-leak regression)

Reviewed 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

…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]>
@jbeda
jbeda merged commit faa9730 into main Aug 12, 2026
15 checks passed
@jbeda
jbeda deleted the issue-459-mecatui-settings branch August 12, 2026 21:03
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.

config: split mecatui client settings out of the server settings.yaml into its own file

1 participant