Skip to content

docs+fix(mecatui): document keymap overrides, live help-overlay bindings, isolate user-config test reads - #460

Merged
jbeda merged 4 commits into
mainfrom
fix/mecatui-keymap-docs-and-test-isolation
Aug 11, 2026
Merged

jbeda merged 4 commits into
mainfrom
fix/mecatui-keymap-docs-and-test-isolation

Conversation

@jbeda

@jbeda jbeda commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Closes #455.

What

Two commits on the mecatui keybinding-override feature:

1. f59bfa21 — docs + help-overlay liveness (issue #455)

The operator keybinding-override feature (keymap: in settings.yaml + the repeatable --keymap flag, validated by cmd/mecatui/keymap) existed and worked, but was documented nowhere, and the ? help overlay rendered most chords as hardcoded literals that would lie after a remap.

  • cmd/mecatui/ui/help.go — build a helpKeys markings struct once on the Model (helpKeyMarkings/keyMarkings/firstKey) and thread it through helpBody/renderHelpOverlay, so every rebindable row (Submit, Newline, Paste, Cancel, MCPPanel, Resources, Prompts, Agents, Effort, ModeSwitch, ExpandTools, Help, Quit, the scroll pair, and the close hint) reads the live binding. The scroll row keeps the platform-adaptive marking while ScrollU/ScrollD hold their defaults and switches to the remapped chords once rebound. The welcome card (zeroStateRows) reads live too. Default rendering is byte-identical (all goldens unchanged).
  • cmd/mecatui/ui/help_test.go — TestHelpReflectsKeyOverride (all rebindable rows + the close hint lead with their overridden chord), TestHelpKeyOverrideEndToEnd (wires Deps.KeyOverrides through New()→View()), TestKeyMarkingsEmptyBindingFallsBack.
  • docs/tui.md — new "Remapping keys" reference: the full action table with scope, the textarea's own (non-rebindable) editing keys, both override surfaces (CLI wins per action), the validation rules.
  • user-docs/what-you-get/mecatui.md — a "Remapping keys" section with the ctrl+a/ctrl+e → line-start/line-end worked example (the motivating use case: the bubbles textarea binds ctrl+a/ctrl+e to line-start/end internally, but mecatui's Agents/Effort actions intercept them; remapping those actions off frees the chords).
  • llms.txt regenerated.

2. b4ae58f4 — test-isolation fix

Three internal/app tests failed on a developer machine whose real ~/.config/mecatl/settings.yaml carries operator settings (posture: auto, Bash(task lint:*) allows): the conventional user-global settings.yaml read (xdgconfig.OSEnv in permconfig.New{Conventional:true} / Build) leaked into the test's permission/posture fold. Added an isolateUserConfig(t) helper (t.Setenv XDG_CONFIG_HOME + HOME to empty temp dirs — the existing fakeUserConfigEnv idiom) and called it in the three tests. Verified load-bearing: removing the isolation re-fails the posture subtest against the real file.

Gates

task lint, task test (root + engine + provider standalone), task docs (llms.txt, 0 broken links), task site:build — all green.

Out of scope (separate issues)

🤖 Generated with mecatl

jbeda and others added 4 commits August 11, 2026 14:41
…e card read live bindings

The operator keybinding-override feature (keymap: in settings.yaml + the
--keymap flag, validator in cmd/mecatui/keymap) existed but was documented
nowhere, and the "?" help overlay rendered most chords as hardcoded literals
that would lie after a remap.

- help.go: build a helpKeys markings struct once on the Model
  (helpKeyMarkings/keyMarkings/firstKey) and thread it through
  helpBody/renderHelpOverlay, so every rebindable row (Submit, Newline, Paste,
  Cancel, MCPPanel, Resources, Prompts, Agents, Effort, ModeSwitch,
  ExpandTools, Help, Quit, the scroll pair, and the close hint) reads the live
  binding. The scroll row keeps the platform-adaptive marking while ScrollU/
  ScrollD hold their defaults and switches to the remapped chords once rebound.
  The welcome card (zeroStateRows) reads live too. Default rendering is
  byte-identical (goldens unchanged).
- help_test.go: TestHelpReflectsKeyOverride asserts all rebindable rows +
  the close hint lead with their overridden chord; TestHelpKeyOverrideEndToEnd
  wires Deps.KeyOverrides through New()→View(); TestKeyMarkingsEmptyBinding-
  FallsBack pins the firstKey fallback.
- docs/tui.md: new "Remapping keys" reference — the full action table with
  scope, the textarea's own (non-rebindable) editing keys, both override
  surfaces (CLI wins per action), and the validation rules.
- user-docs/what-you-get/mecatui.md: a "Remapping keys" section with the
  ctrl+a/ctrl+e → line-start/line-end worked example.

Issue #455. Live reload (#456) and footer/inline-card liveness (#457) are
separate follow-ups.

Co-Authored-By: mecatl <[email protected]>
…s real ~/.config

Three internal/app tests failed on a developer machine whose real
~/.config/mecatl/settings.yaml carries operator settings (posture: auto,
Bash(task lint:*) allows): the conventional user-global settings.yaml read
(xdgconfig.OSEnv) leaked into the test's permission/posture fold.

- TestBuildOperatorYAMLPostureSeam/project_tier_posture_is_ignored: the real
  user-global posture: auto overrode the expected strict default.
- TestResolveTrustMonotonicPositiveDenyHonoured + ...Remembered...: the real
  user-global Bash allow rules surfaced as a ScopeCLI allow, tripping the
  "trust must not turn a project DENY into an ALLOW" assertion.

The trust tests isolate the *trust* read via the trustEnv seam but build
permconfig.New{Conventional:true} with no env, which independently reads the
real user-global file via xdgconfig.OSEnv (resolve.go). Add an
isolateUserConfig(t) helper (t.Setenv XDG_CONFIG_HOME + HOME to empty temp
dirs, the existing fakeUserConfigEnv idiom) and call it in the three tests.
Verified load-bearing: removing the isolation re-fails the posture subtest
against the real file.

Co-Authored-By: mecatl <[email protected]>
Signed-off-by: Joe Beda <[email protected]>
The llms.txt committed in f59bfa2 was regenerated while the developer's
local-only, gitignored HANDOFF.md + CLAUDE.local.md were on disk, so matlatl
counted them as corpus orphans ("2 orphan document(s)"). CI's
'llms.txt is up to date' step regenerates on a clean checkout (no orphans)
and fails the staleness guard on the mismatch.

Regenerate with those files absent so the committed surface matches CI.

Co-Authored-By: mecatl <[email protected]>
@jbeda
jbeda merged commit 45bfd77 into main Aug 11, 2026
15 checks passed
@jbeda
jbeda deleted the fix/mecatui-keymap-docs-and-test-isolation branch August 11, 2026 23:23
jbeda added a commit that referenced this pull request Aug 12, 2026
…ttings.yaml (#481)

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]>
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.

docs: mecatui keybindings are configurable but undocumented

1 participant