Skip to content

fix(mecatui): render live keymap affordances - #467

Merged
jbeda merged 3 commits into
mainfrom
issue-457-keymap-affordances
Aug 12, 2026
Merged

jbeda merged 3 commits into
mainfrom
issue-457-keymap-affordances

Conversation

@JAORMX

@JAORMX JAORMX commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • derive every user-visible keybinding affordance from the active mecatui keymap
  • preserve genuinely local, non-keymap controls and byte-identical default labels
  • add liveness coverage across footer, inline cards, permission dialogs, and overlay navigation
  • document which displayed controls follow remapped bindings

Closes #457

Verification

  • task lint
  • go test ./cmd/mecatui/ui/ ./cmd/mecatui/ui/welcome/ -count=1
  • task test:golden
  • task docs
  • task site:build
  • go run ./cmd/mecademo

A later independent task test rerun hit the host's /tmp disk quota. Re-running with a repo-local TMPDIR made the changed TUI packages pass but invalidated unrelated tests that intentionally require a temporary directory outside a Git repository. CI remains the authoritative full-suite run.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes mecatui’s user-visible keybinding affordances “live” by deriving rendered chord strings from the active keymap (rather than hardcoded literals), so operator overrides are accurately reflected across the TUI and its documentation.

Changes:

  • Routed footer, inline-card affordances, overlays, and permission/plan dialogs through shared “help key markings” derived from the active keymap.
  • Updated multiple overlays (agents/team/MCP/models/sessions/worktrees/schedule/skills/soul/usermodel/effort) to render navigation and action hints from live bindings while preserving genuinely local literal controls.
  • Expanded docs and tests to cover keymap-affordance liveness across the additional surfaces.

Reviewed changes

Copilot reviewed 35 out of 35 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
user-docs/what-you-get/mecatui.md Documents which visible controls follow remapped key bindings vs. remain literal.
docs/tui.md Updates the remapping and permission-modal sections to reflect live affordance rendering behavior.
cmd/mecatui/ui/worktrees.go Makes worktrees overlay footer/navigation hints use live keymap markings.
cmd/mecatui/ui/welcome/welcome.go Allows the welcome prompt hint to display the live submit chord.
cmd/mecatui/ui/view.go Threads live keymarkings into overlay renderers and updates footer strings to be keymap-derived.
cmd/mecatui/ui/usermodel.go Uses live Close marking in the user-model overlay footer hint.
cmd/mecatui/ui/update.go Makes quit-armed hints and various “press enter” status strings use the live submit/quit bindings.
cmd/mecatui/ui/team.go Updates team overlay roster/focus/tasks/findings hints to use live navigation/action markings.
cmd/mecatui/ui/soul.go Uses live scroll/close markings in the soul overlay footer hint.
cmd/mecatui/ui/skills.go Updates skills overlay hints to combine literal arrows with live keymap-backed scroll/close markings.
cmd/mecatui/ui/skills_test.go Adjusts test helpers for the updated skills rendering signature (helpKeys).
cmd/mecatui/ui/sessions.go Updates sessions overlay hints to use live Choose/Tab/Close markings.
cmd/mecatui/ui/schedule.go Uses live Choose/Close markings where applicable; keeps schedule’s local single-letter controls literal.
cmd/mecatui/ui/render_wrap_test.go Updates renderer construction to include default help key markings.
cmd/mecatui/ui/render_cache_test.go Updates renderer construction to include default help key markings for cache vs. fresh comparisons.
cmd/mecatui/ui/quit_test.go Updates quit-guard tests to validate the new binding-derived quit hint.
cmd/mecatui/ui/permission.go Makes permission modal and plan-review affordances derive mnemonics/labels from live approval bindings.
cmd/mecatui/ui/models.go Updates models picker hints to use live keymap markings (while keeping literal arrows for filtering safety).
cmd/mecatui/ui/models_test.go Adjusts tests for updated models rendering signature (helpKeys).
cmd/mecatui/ui/model.go Computes keymap markings early for placeholder text and renderer construction.
cmd/mecatui/ui/mcp.go Threads live keymarkings through MCP overlay/panels and collapse markers.
cmd/mecatui/ui/mcp_test.go Adds targeted test coverage for MCP resource preview collapse marker behavior.
cmd/mecatui/ui/help.go Extends help-key markings to cover additional overlays and approval/navigation affordances.
cmd/mecatui/ui/footer.go Updates team/subagent/parallel footer affordances to use the live Agents chord; adds shared approval-label helpers.
cmd/mecatui/ui/emptystate_test.go Updates empty-state rendering calls for new overlay signatures (helpKeys).
cmd/mecatui/ui/effort.go Updates effort picker footer hints to use live navigation/choose/close markings.
cmd/mecatui/ui/diff_test.go Updates renderer construction to include default help key markings.
cmd/mecatui/ui/background_subagent_test.go Updates agents overlay subagent roster/focus rendering calls for new signatures (helpKeys).
cmd/mecatui/ui/argsummary_test.go Adjusts a test to use the renderer method for result body rendering.
cmd/mecatui/ui/agents_overlay.go Updates agents overlay (subagents/parallel/teams) navigation hints to use live keymap markings.
cmd/mecatui/ui/agents_overlay_test.go Updates footer-tier tests to pass the live Agents marking into the new footer helpers.
cmd/mecatui/ui/agents_inventory.go Uses live scroll/close markings in agents inventory overlay footer hints.
cmd/mecatui/ui/agents_inventory_test.go Adjusts tests for updated agents-inventory rendering signature (helpKeys).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cmd/mecatui/ui/mcp_test.go Resolved
JAORMX and others added 2 commits August 12, 2026 14:07
The plan-review action bar glued the LIVE approval chord onto the word's
stem ("[" + approvalMnemonic(hk.allow) + "]pprove & run"). For a bare-rune
rebind that read as a typo ("[Y]pprove & run"), and for a MODIFIED chord
(e.g. Allow: ctrl+y — legal because the approval keys are not in the
validator's globalOpen bare-rune set) it rendered the outright broken
"[ctrl+y]pprove & run".

Route the three buttons through a new planApprovalButtonLabel helper that
mirrors the generic modal's approvalButtonLabel default-vs-override split:
the DEFAULT a/w/d chords keep the historical word-embedded form
("[A]pprove & run" / "[W] auto-accept edits" / "[D] iterate")
byte-for-byte, and any override degrades to an honest standalone form
("[Y] approve & run" / "[ctrl+y] approve & run"). A bare-rune rebind now
reads "[Y] approve & run" instead of the prior wordplay "[Y]pprove & run",
matching the generic modal and the PR's documented behaviour.

Tests: TestPlanReviewActionBarModifiedChordDegrades pins the modified-chord
regression (fails on the unfixed branch with "[ctrl+y]pprove & run");
TestPlanReviewActionBarDefaultBytesUnchanged is the golden-safety guard for
the default wordplay; TestPlanReviewActionBarReflectsKeyOverride now expects
the bare-rune standalone form and asserts the stem is never glued.

Co-Authored-By: Juan Antonio Osorio <[email protected]>
Co-Authored-By: mecatl <[email protected]>
@jbeda

jbeda commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Looks good -- one thing missing and I had mecatl make a quick patch.

@jbeda
jbeda merged commit b544f8c into main Aug 12, 2026
13 of 15 checks passed
@jbeda
jbeda deleted the issue-457-keymap-affordances branch August 12, 2026 20:12
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.

mecatui: footer / inline-card affordance strings don't reflect keymap overrides

3 participants