Skip to content

tui: fast-copy keybinds for selected node hierarchy (y/Y)#2

Merged
plattnum merged 1 commit into
mainfrom
feat/fast-copy
Apr 26, 2026
Merged

tui: fast-copy keybinds for selected node hierarchy (y/Y)#2
plattnum merged 1 commit into
mainfrom
feat/fast-copy

Conversation

@plattnum
Copy link
Copy Markdown
Owner

Summary

Adds two clipboard shortcuts to plnk-tui for handing the currently selected node off to an AI agent (or any paste target) without retyping IDs.

Key Output
y Compact JSON of the selection's ID hierarchy (project / board / list / card, each with id + name)
Y Paste-ready plnk <resource> snapshot --output json command, preceded by a breadcrumb comment

Both keys write to the system clipboard via the OSC 52 escape sequence. No native clipboard dependency — works locally, inside tmux (with set -g set-clipboard on), and over SSH.

Handles all six TreeKey variants: project, board, list, card, grouped card, and label group (which resolves to its underlying list).

Security

Project / board / list / card names are user-editable on the Planka server. A name containing \n would otherwise break out of the leading # comment line in the Y output and put attacker-controlled text on its own line — executable on shell paste. The breadcrumb embedded in the shell command form has all control characters (C0, DEL, C1) stripped via char::is_control(), replaced with a single space. The JSON form is unaffected because serde_json escapes control characters by definition.

Test plan

  • cargo test -p plnk-tui — 13 new unit tests pass
    • RFC 4648 base64 vectors + edge bytes
    • All six TreeKey variants resolve correctly
    • JSON escaping for ", \\, \n
    • Newline-injection attack on shell form blocked (exact 2-line output)
    • \r, \x1b (ANSI escape), \x00 stripped from breadcrumb
  • cargo test — all 144+ workspace tests pass
  • cargo clippy --all-targets -- -D warnings — clean
  • cargo fmt --check — clean
  • Manual: launch plnk-tui, select a card, press y, paste — confirm JSON arrives on clipboard
  • Manual: same flow with Y — confirm breadcrumb + snapshot command arrives
  • Manual: verify behavior over SSH and inside tmux

Docs

  • docs/tui/fast-copy.md — new feature page (formats, OSC 52 mechanism, terminal compatibility table, security model)
  • docs/tui/keybindings.mdy / Y rows under Global
  • docs/tui/overview.md — feature bullet + cross-link
  • README.md — one-liner + docs link

Adds two clipboard shortcuts to plnk-tui for handing the currently
selected node off to an AI agent (or paste target) without retyping IDs:

  y  copy compact JSON of the selection's ID hierarchy
  Y  copy a paste-ready `plnk <resource> snapshot --output json`
     command preceded by a breadcrumb comment

Both write to the system clipboard via the OSC 52 escape sequence, so
the feature works locally, inside tmux (with `set -g set-clipboard on`),
and over SSH without pulling in a native clipboard dependency.

Selection types handled: project, board, list, card, grouped card, and
label group (resolves to its underlying list).

Project, board, list, and card names are user-editable on the Planka
server. Control characters are stripped from the breadcrumb embedded in
the shell command form to prevent newline injection from breaking out
of the leading `#` comment line on paste. The JSON form is unaffected
because serde_json escapes control characters by definition.

Includes 13 unit tests covering RFC 4648 base64 vectors, all six
TreeKey variants, JSON escaping, and control-character sanitization.

Docs:
  docs/tui/fast-copy.md       new feature page
  docs/tui/keybindings.md     y/Y rows under Global
  docs/tui/overview.md        feature bullet + cross-link
  README.md                   one-liner + docs link
@plattnum plattnum merged commit aed6b04 into main Apr 26, 2026
8 checks passed
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.

1 participant