feat: make linked workspace names clickable in the sidebar, CLI, and post-scan dialog

Merged
SA
2mo ago
+633-93

Issue for this PR

Closes #1275

Type of change

  • New feature

What does this PR do?

Workspace names shown once a project is linked are now clickable / open the workspace in the browser, in three places:

  • TUI sidebar tile (workspace-sidebar.tsx) — the workspace name and its manage URL render underlined in the accent color and open the browser on click. Mouse events land on the enclosing <text> block rather than the inline <span>, and the visible affordance is a styled span rather than a real <a href> — matching the existing pattern in the sidebar footer's docs/community links, since raw <a href> hyperlink nodes crash in the current @opentui/solid JSX layer.
  • AlreadyLinkedDialog (shown when re-entering an already-linked project) — added an "Open in browser" menu option. The plugin-facing DialogSelect API only takes a plain string title (no titleView/JSX escape hatch like the native packages/tui component has), so the workspace name in the title itself can't be inline-clickable — a selectable option is the equivalent affordance within that API.
  • altimate-code link CLI (cli/cmd/link.ts) — the "Currently linked to "X"" prompt and the matching picker row now wrap the workspace name in a real OSC 8 terminal hyperlink plus underline styling. This is plain stdout text (not the TUI's JSX renderer), so a real hyperlink escape sequence works directly — no click handler needed, the terminal itself makes it clickable.

Also extracted the guarded open() + toast-on-failure logic that WorkspaceLinkedDialog already had into a shared openManageUrl() helper, reused by the sidebar tile and the new AlreadyLinkedDialog option.

How did you verify your code works?

  • tsc --noEmit clean on all three changed files
  • bun test test/altimate/plugin/workspace.test.ts — 41/41 pass, unchanged
  • Full monorepo typecheck (pre-push hook) — 13/13 tasks pass
  • Built a local binary and manually verified in an isolated sandbox (fake credentials/state, no real network):
    • Sidebar tile renders the workspace name + manage URL underlined in accent color; raw ANSI capture confirms the \x1b[4m underline + accent RGB codes wrap only the link text
    • AlreadyLinkedDialog's "Open in browser" option renders and is wired to the same guarded open helper (triggered via the TUI's own /tui/publish event API against a headless serve + attach pair, mirroring the real post-scan trigger)
    • CLI link picker: raw OSC 8 escape sequence (\x1b]8;;<url>\x1b\\<name>\x1b]8;;\x1b\\) confirmed wrapping the workspace name in both the message and the picker row

Screenshots / recordings

Verified visually with terminal screenshots (VHS) during development for all three surfaces — sidebar tile (underlined accent link), AlreadyLinkedDialog's new option, and the CLI's OSC-8-linked workspace name. Not embedded here (static images don't convey the click-to-open interaction well); happy to attach on request.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

🤖 Generated with Claude Code

https://claude.ai/code/session_01JsVwcBQP6VUwqEej3vK2zG

Summary by CodeRabbit

  • New Features

    • Workspace names and management URLs are now clickable in the workspace sidebar and can open in a browser.
    • Management links correctly preserve URL paths while removing conflicting query and fragment components.
    • The link command now displays plain-text management URLs when clickable links aren’t supported.
  • Bug Fixes

    • Improved terminal hyperlink compatibility across TTY and non-TTY environments.
    • Enhanced terminal text sanitization to remove control characters and prevent malformed links.
    • Prevented incorrectly placed workspace management URLs.