Skip to content

feat(keyboard): sequence-grammar chord helpers for leader chords (RIG-2707) - #612

Merged
mattwilkinsonn merged 1 commit into
mainfrom
compass-ux/rig-2707-chord-grammar-helpers
Aug 26, 2026
Merged

feat(keyboard): sequence-grammar chord helpers for leader chords (RIG-2707)#612
mattwilkinsonn merged 1 commit into
mainfrom
compass-ux/rig-2707-chord-grammar-helpers

Conversation

@rigel-mintaka

@rigel-mintaka rigel-mintaka commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

This PR is part of a stack containing 4 PRs:

  1. main
  2. "feat(keyboard): sequence-grammar chord helpers for leader chords (RIG-2707)" (this PR)
  3. feat(ui): CoachTip coaching tooltip component (RIG-2703) #615
  4. feat(ui): adopt CoachTip across command-backed chrome + register sidebar toggles (RIG-2704) #618
  5. docs(ui): document the shipped CoachTip consumer + retarget the ShortcutChip note (RIG-2705) #620

Adds three pure, table-independent helpers to keymap.ts for the leader/mnemonic-chord grammar frozen in docs/designs/product/compass-leader-chords/design.md (T1):

  • chordSegments(chord) — split a chord on its single space; a plain chord yields a one-element array, a sequence like "G B" yields ["G", "B"]. Space is a collision-free separator because the literal Space key normalizes to the "Space" token in the dispatcher.
  • leaderPrefixes(keymap, platform) — the resolved first segment of every multi-segment row, derived from the table so the dispatcher never hard-codes a leader key.
  • formatChordForDisplay(chord, platform) — a single chord resolves through resolveChord ("Mod+B""Cmd+B"); a sequence joins resolved segments with " then " ("G B""G then B"). The single formatter behind every display surface.

Extends the KeymapEntry doc block with the sequence grammar and its three authoring rules (exactly two segments; every segment modifier-less; the leader prefix never doubles as a complete chord).

Pure additions: no production caller and no shipped-helper change (shortcutFor/shortcutForAria hardening and the DEFAULT_KEYMAP sequence rows are T2). formatChordForDisplay is the shared root — RIG-2484 T2/T3 and RIG-2530's CoachTip (RIG-2703) both consume it.

Tests extend keymap.test.ts over a fixture keymap (the real table carries no sequence rows until T2): segment splitting, leader-prefix derivation, and single-vs-sequence display formatting on both platforms.

Ledger-impact: none. DL-248..DL-252 for this record landed with the design PR (#544); this impl slice ratifies no new decision.

Refs RIG-2707

Co-authored-by: Matt Wilkinson matt@rigel.build

@linear-code

linear-code Bot commented Aug 25, 2026

Copy link
Copy Markdown

RIG-2707

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown

Compass engineering docs preview: https://compass-ux-rig-2707-chord-gr.compass-eng-docs.pages.dev

Deployed from compass-ux/rig-2707-chord-grammar-helpers at 24df261.

…-2707)

Adds three pure, table-independent helpers to `keymap.ts` for the leader/mnemonic-chord grammar frozen in `docs/designs/product/compass-leader-chords/design.md` (T1):

- `chordSegments(chord)` — split a chord on its single space; a plain chord yields a one-element array, a sequence like `"G B"` yields `["G", "B"]`. Space is a collision-free separator because the literal Space key normalizes to the `"Space"` token in the dispatcher.
- `leaderPrefixes(keymap, platform)` — the resolved first segment of every multi-segment row, derived from the table so the dispatcher never hard-codes a leader key.
- `formatChordForDisplay(chord, platform)` — a single chord resolves through `resolveChord` (`"Mod+B"` → `"Cmd+B"`); a sequence joins resolved segments with `" then "` (`"G B"` → `"G then B"`). The single formatter behind every display surface.

Extends the `KeymapEntry` doc block with the sequence grammar and its three authoring rules (exactly two segments; every segment modifier-less; the leader prefix never doubles as a complete chord).

Pure additions: no production caller and no shipped-helper change (`shortcutFor`/`shortcutForAria` hardening and the `DEFAULT_KEYMAP` sequence rows are T2). `formatChordForDisplay` is the shared root — RIG-2484 T2/T3 and RIG-2530's CoachTip (RIG-2703) both consume it.

Tests extend `keymap.test.ts` over a fixture keymap (the real table carries no sequence rows until T2): segment splitting, leader-prefix derivation, and single-vs-sequence display formatting on both platforms.

Ledger-impact: none. DL-248..DL-252 for this record landed with the design PR (#544); this impl slice ratifies no new decision.

Refs RIG-2707

Co-authored-by: Matt Wilkinson <matt@rigel.build>
@rigel-mintaka
rigel-mintaka force-pushed the compass-ux/rig-2707-chord-grammar-helpers branch from 6a8939e to 24df261 Compare August 26, 2026 03:31
@mattwilkinsonn
mattwilkinsonn merged commit 90f01bf into main Aug 26, 2026
76 checks passed
@mattwilkinsonn
mattwilkinsonn deleted the compass-ux/rig-2707-chord-grammar-helpers branch August 26, 2026 04:26
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.

2 participants