-
Notifications
You must be signed in to change notification settings - Fork 18.5k
[FEATURE] OSC 8 Hyperlinks for Clickable File Paths #13008
Description
Problem Statement
When Claude Code outputs file paths like /Users/user/project/src/foo.ts:42, they are not clickable in terminals that support hyperlinks (Kitty, iTerm2, WezTerm, Windows Terminal).
This happens because:
- Paths are output as plain text without the
file://scheme - ANSI color codes wrapped around paths break terminal pattern matching
- The
path:lineformat isn't recognized as a clickable URL
Users must manually copy paths or use terminal-specific workarounds (like Kitty's hints kitten) to navigate to files.
Proposed Solution
Emit file paths using the OSC 8 hyperlink escape sequence, which is the terminal standard for embedded hyperlinks:
\033]8;;file:///absolute/path/to/file.ts\033\\file.ts:42\033]8;;\033\\
This makes paths clickable with a single click (or Cmd/Ctrl+click depending on terminal config). Many modern CLI tools already do this (ls, exa/eza, fd, bat).
Reference: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
Alternative Solutions
- Workaround I currently use: Kitty's hints kitten (
Cmd+Shift+Fto select paths) - works but requires extra keystrokes - file:// prefix only: Would partially help but less robust than OSC 8
- Opt-in config: Could be a setting if terminal compatibility is a concern
Use Case Example
- I ask Claude Code to find a bug in my project
- Claude outputs: "The issue is in
/Users/victor/project/src/auth.ts:142" - Currently: I manually copy the path or use hints kitten
- With this feature: I Cmd+click the path and it opens in my editor
This is especially valuable when Claude references multiple files in a single response.
Additional Context
OSC 8 terminal support (https://github.com/Alhadis/OSC8-Adoption):
- Kitty, iTerm2 (3.1+), WezTerm, Windows Terminal
- GNOME Terminal (VTE 0.50+), foot, Konsole
- Alacritty (recent versions)
Related but distinct from #609 (URL text wrapping) - this is about file paths not being hyperlinks at all.
Environment: macOS, Kitty terminal with detect_urls yes, allow_hyperlinks yes