Render URLs as clickable OSC 8 hyperlinks, styled to stand out #41

Merged
geusebio merged 1 commit from feature/clickable-urls into main 2026-08-25 13:59:03 +00:00
Owner

What

Every URL sc prints — a deployment's page, a failure page, the token or
billing pages — was plain text, no more distinct than anything else on the
line, and never clickable even in terminals that support it.

Adds ui.LinkTo (and the underlying ui.Link), which wraps a URL in an
OSC 8 terminal hyperlink — the mechanism iTerm2, kitty, WezTerm and Windows
Terminal all implement — styled bold/cyan/underlined so it reads as a link.
The row-style outputs (Watch it:, See it:, Created ...) go further and
show a short clickable word ("open") in place of the bare address, since a
supporting terminal now carries you there directly by clicking the word.

Off a terminal, or with $NO_COLOR set, everything falls back to the plain
address exactly as before — unchanged behaviour for CI logs and piped
output, which have nothing to click and still need the text.

Where

  • internal/ui/link.go (new) — Link/LinkTo and the OSC 8 wrapping
  • internal/cli/deploy.go — the uploaded revision's page, and a 409
    collision's page
  • internal/cli/preflight.go — a newly created application's page
  • internal/cli/apps.go — a failed deployment's failure page
  • internal/cli/login.go — the token-minting page
  • internal/cli/deploy_progress.go — the failure page and "watch it at"
    sentences embedded in errors (printed on stderr by cmd/sc/main.go)
  • internal/cli/service.go, internal/cli/toggle.go — the billing page in
    a top-up refusal

Test plan

  • go test ./... — all green, including new internal/ui/link_test.go
    covering both the clickable and fallback paths, $NO_COLOR, and an
    empty URL
  • go vet ./..., gofmt -l ., golangci-lint run ./... — clean
  • hack/coverage.sh — no package fell below its floor
    (internal/ui 97.3% → 97.6%, internal/cli 80.7% → 85.8%)
  • Manually verified under a real pty (script) that sc login emits a
    correct OSC 8 sequence wrapping the styled URL
## What Every URL `sc` prints — a deployment's page, a failure page, the token or billing pages — was plain text, no more distinct than anything else on the line, and never clickable even in terminals that support it. Adds `ui.LinkTo` (and the underlying `ui.Link`), which wraps a URL in an OSC 8 terminal hyperlink — the mechanism iTerm2, kitty, WezTerm and Windows Terminal all implement — styled bold/cyan/underlined so it reads as a link. The row-style outputs (`Watch it:`, `See it:`, `Created ...`) go further and show a short clickable word ("open") in place of the bare address, since a supporting terminal now carries you there directly by clicking the word. Off a terminal, or with `$NO_COLOR` set, everything falls back to the plain address exactly as before — unchanged behaviour for CI logs and piped output, which have nothing to click and still need the text. ## Where - `internal/ui/link.go` (new) — `Link`/`LinkTo` and the OSC 8 wrapping - `internal/cli/deploy.go` — the uploaded revision's page, and a 409 collision's page - `internal/cli/preflight.go` — a newly created application's page - `internal/cli/apps.go` — a failed deployment's failure page - `internal/cli/login.go` — the token-minting page - `internal/cli/deploy_progress.go` — the failure page and "watch it at" sentences embedded in errors (printed on stderr by `cmd/sc/main.go`) - `internal/cli/service.go`, `internal/cli/toggle.go` — the billing page in a top-up refusal ## Test plan - [x] `go test ./...` — all green, including new `internal/ui/link_test.go` covering both the clickable and fallback paths, `$NO_COLOR`, and an empty URL - [x] `go vet ./...`, `gofmt -l .`, `golangci-lint run ./...` — clean - [x] `hack/coverage.sh` — no package fell below its floor (`internal/ui` 97.3% → 97.6%, `internal/cli` 80.7% → 85.8%) - [x] Manually verified under a real pty (`script`) that `sc login` emits a correct OSC 8 sequence wrapping the styled URL
Render URLs as clickable OSC 8 hyperlinks, styled to stand out
All checks were successful
CI / build (pull_request) Successful in 1m7s
a71b2e5a22
Every URL sc prints — a deployment's page, a failure's page, the token or
billing pages — was plain text competing with the rest of the line. On a
terminal that supports OSC 8 hyperlinks (iTerm2, kitty, WezTerm, Windows
Terminal, ...) ui.LinkTo now wraps it as a coloured, underlined, clickable
link; the row-style outputs ("Watch it:", "See it:", "Created ...") go
further and show a short clickable word ("open") instead of the bare
address, since the terminal now carries you there directly.

Off a terminal, or with $NO_COLOR set, it falls back to the plain address
exactly as before — a CI log or piped output has nothing to click, so it
still needs the text to read or grep.
Sign in to join this conversation.
No reviewers
No labels
in-progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Grey.ooo/someones.computer_agent!41
No description provided.