stacklok / stacklok/mecatl

mecatui: click-to-open URLs in scrollback

Open
#489 0 comments 0 reactions 1 assignee View on GitHub

@jbeda is already working on this.

Since Aug 15, 2026.

enhancement tui
Dominant language
Go
Stars
152
Forks
16
Avg merge
14h 48m
Merged PRs (30d)
536

Description

Split out of #486 (mouse interactions). The first PR ships clickable approval/plan-review buttons; this is the follow-up for click-to-open links in the conversation scrollback.

Behaviour

A single left-click (press+release, no drag) on a URL in the conversation scrollback opens it in the platform browser. Drag-selection, double-click word-select, and triple-click line-select are unchanged — the open fires only on a clean single click (clickCount==1 + empty selection at release, the existing onMouseRelease empty branch in cmd/mecatui/ui/update.go).

Trust boundary (load-bearing)

Scrollback content is model-influenced and untrusted. The URL must be:

  • parsed with net/url.Parse (never regex-guess the scheme),
  • gated on a scheme allowlist {https, http, mailto} (the allowlist lives in ui, the consumer),
  • passed to the opener as ONE direct argv element — NEVER through a shell (sh -c would be command injection on file:///sh: schemes),
  • length-clamped (e.g. 2048) and control-byte-rejected.

Shape (from the #486 plan)

  • client/urllaunch.go (new): URLOpener interface + NewURLOpener() probing xdg-open/open/rundll32 — mirrors client/clipboard.go's probe + injected-runner pattern. os/exec stays in client, never in ui.
  • ui/urls.go (new): urlAtLine(stripped, col) tokenizer (grapheme-walk like wordAt), scheme allowlist, openURLCmd (async tea.Cmd like shellWriteCmd), muted status on success/failure.
  • Deps gains Opener client.URLOpener (nil disables).
  • OSC8 hyperlink RENDERING is explicitly out of scope (would break View goldens + interfere with styleSelection ANSI splicing); click-to-open works by hit-testing text against a URL scan at click time, independent of rendering.

Known v1 limitation: a URL soft-wrapped across two viewport lines is only detected from the clicked line's fragment.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.