···77struct KeyCommand: ParsableCommand {
88 static let configuration = CommandConfiguration(
99 commandName: "key",
1010- abstract: "Send a user key event to a terminal pane.",
1010+ abstract: "Send a keyboard shortcut or special key to a terminal pane.",
1111 discussion: """
1212 With one positional argument, the key is sent to the current pane.
1313 With two positional arguments, the first is the target (auto-resolved) and
1414 the second is the key token.
1515+1616+ Printable punctuation currently follows ANSI-style key token semantics.
1717+ For shifted symbols, prefer modifier combos such as shift-1 or shift-left-bracket.
1518 """
1619 )
1720
···1313- normalize aliases (`return` -> `enter`, `escape` -> `esc`, `pgup` -> `pageup`, ...)
1414- accept modifier prefixes and combinations such as `cmd-c`, `shift-tab`, `opt-enter`, `cmd-shift-k`
1515- accept additional named keys such as `delete-forward`, `insert`, and `f1`...`f12`
1616+- keep CLI token acceptance aligned with the runtime's ANSI-style NSEvent materialization
1617- add `--repeat <n>` as first-class input instead of forcing shell loops
1718- split `requested` vs `normalized` in output so callers can debug token normalization
1819- add `delivery` counters for machine verification (`attempted` / `delivered`)
···2122## Contract goals
22232324- `key` should be deterministic for agent loops and TUI automation.
2525+- v1 follows ANSI-style key token semantics for shortcuts, special keys, and supported punctuation.
2626+- full layout-aware fidelity across keyboard layouts is out of scope for v1.
2427- output must clearly answer:
2528 - what was requested
2629 - what token was actually accepted
···66696770- navigation keys such as `tab`, `up`, `down`, `left`, `right`, `pageup`, `pagedown`, `home`, `end`
6871- editing keys such as `enter`, `backspace`, `delete-forward`, `insert`
6969-- printable keys such as letters, digits, and common punctuation
7272+- printable keys such as letters, digits, and supported ANSI punctuation tokens
7073- control combinations such as `ctrl-c`, `ctrl-d`, `ctrl-l`, `ctrl-z`
7174- shortcut combinations such as `cmd-c`, `cmd-shift-k`, `shift-tab`, `opt-enter`
7275- function keys `f1`...`f12`
···8386- `pgdn` -> `pagedown`
8487- `forward-delete` / `deleteforward` -> `delete-forward`
8588- `ins` -> `insert`
8989+- punctuation aliases such as `[` -> `left-bracket`, `]` -> `right-bracket`, `,` -> `comma`, `'` -> `quote`
8690- `command-*` -> `cmd-*`
8791- `alt-*` / `option-*` -> `opt-*`
8892- `ctrl+*` -> `ctrl-*`
9393+9494+### ANSI punctuation note
9595+9696+- prefer canonical ANSI-style punctuation tokens such as `minus`, `equal`, `comma`, `period`, `slash`, `backslash`, `quote`, `left-bracket`
9797+- express shifted symbols via modifier combos such as `shift-1`, `shift-quote`, `shift-left-bracket`
9898+- raw shifted symbol literals such as `!`, `@`, `{`, `}` are intentionally unsupported in v1
899990100### `--repeat`
91101