anomalyco / anomalyco/opencode

[FEATURE]: Add "Copy ID", "Copy Name", and "Copy Link" to TUI session context menu

Open
#47,746 0 comments 0 reactions 1 assignee View on GitHub

@kommander is already working on this.

Since Sep 7, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Feature hasn't been suggested before.
  • I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request

To: OpenCode Maintainers <anomalyco/opencode>
Subject: [RFC/UX] Add Copy ID, Copy Name, and Copy Link to TUI Session Context Menu

Hey team,

In the current TUI, right-clicking a session item in the sidebar opens a minimal context menu with three entries: "New tab", "Rename", and "Close".

When working across multiple sessions, referencing a session outside the TUI is a frequent need:

  1. Grabbing the Session ID (ses_...) to run CLI operations (opencode session <id>), inspect SQLite state, or pass to local automation scripts.
  2. Grabbing the Session Title to include in commit messages, PR descriptions, or dev logs.
  3. Grabbing the Session Link (share URL or web session URL) to send to teammates or view in the browser.

Currently, copying any of these requires either selecting text directly with terminal mouse-mode bypass (which often breaks across lines or captures UI padding) or manually searching storage logs.

Adding direct clipboard actions to the context menu resolves this without introducing new UI surfaces.


UI / Interaction Mockup
Current Context Menu

Right-clicking a session entry in the vertical sidebar:

  refactor authentication
  workspace            ┌──────────┐
                       │ New tab  │
: fix connection timeout│ Rename   │
  workspace            │ Close    │
                       └──────────┘
: add logging middleware
  workspace

+ New session
Proposed Context Menu

Group clipboard actions between navigation and destruction:

  refactor authentication
  workspace            ┌───────────────┐
                       │ New tab       │
: fix connection timeout│ Rename        │
  workspace            │ ───────────── │
                       │ Copy ID       │
: add logging middleware│ Copy Name     │
  workspace            │ Copy Link     │
                       │ ───────────── │
+ New session          │ Close         │
                       └───────────────┘
Interaction Flow
  1. Right-click any session item in the vertical tab list.
  2. Select "Copy ID", "Copy Name", or "Copy Link":
    • Writes the target string to system clipboard via clipboard.write(...) (supporting OSC 52 / host clipboard).
    • Closes the context menu.
    • Shows a brief toast alert at the top corner:
      ┌───────────────────────────────┐
      │ Session ID copied to clipboard│
      └───────────────────────────────┘
      

Implementation Sketch

In packages/tui/src/ (where the session tab context menu items are constructed), sessionID and title are already present in the menu state:

const clipboard = useClipboard()
const toast = useToast()

const menuItems = createMemo(() => {
  const sessionID = state.sessionID
  const title = state.title
  const shareURL = state.shareURL // resolved via sync.session.get(sessionID)?.share?.url

  return [
    ...(tabs.add ? [{ title: "New tab", run: () => tabs.add?.() }] : []),
    ...(sessionID ? [
      ...(tabs.promote && tabs.isPreview?.(sessionID) 
        ? [{ title: "Keep open", run: () => tabs.promote?.(sessionID) }] 
        : []),
      { title: "Rename", run: () => DialogSessionRename.show(dialog, sessionID, title) },
      {
        title: "Copy ID",
        run: async () => {
          await clipboard.write(sessionID)
          toast.show({ message: "Copied session ID", variant: "info" })
        },
      },
      {
        title: "Copy Name",
        run: async () => {
          await clipboard.write(title)
          toast.show({ message: "Copied session title", variant: "info" })
        },
      },
      ...(shareURL ? [{
        title: "Copy Link",
        run: async () => {
          await clipboard.write(shareURL)
          toast.show({ message: "Copied session link", variant: "info" })
        },
      }] : []),
      { title: "Close", run: () => tabs.close(sessionID) },
    ] : []),
  ]
})
Edge Cases & Details
  • Session Link availability: If the session has not been shared publicly yet, "Copy Link" can either copy the local web server URL (http://localhost:<port>/session/<id>) or remain omitted when no link is active.
  • Clipboard integration: The existing TUI clipboard provider already wraps OSC 52 and host clipboard commands, so no additional dependencies are required.

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.