feat(tui): add clickable URLs and file paths in tool output#15631
feat(tui): add clickable URLs and file paths in tool output#15631brendandebeasi wants to merge 2 commits intoanomalyco:devfrom
Conversation
|
The following comment was made by an LLM, it may be inaccurate: I found a potentially related PR: PR #7280: feat: add OSC8 hyperlink support for clickable file paths and URLs This appears to be addressing the same feature — adding OSC8 hyperlink support for clickable file paths and URLs in the TUI. It may have been a previous attempt or related work that should be reviewed for potential overlap or reuse. |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
Hey @thdxr @adamdotdevin — would love to get your eyes on this when you get a chance. This makes file paths and URLs clickable throughout the TUI (Read, Write, Edit, Bash output, etc.) via OSC8 hyperlinks. It's a small quality-of-life improvement that makes navigating tool output a lot faster. Happy to address any feedback! |
- Add TextWithLinks component for parsing and rendering URLs/file paths - Add FilePathLink component for file:// protocol links - Refactor Link component to use native <a> tags with OSC8 support - Make tool output paths clickable (Read, Write, Edit, Glob, Grep, List) - Make bash output URLs/paths clickable via TextWithLinks - Support BlockTool titles with JSX elements for rich link rendering
0f4790c to
990ce81
Compare
Issue for this PR
Not linked to a specific issue — wanted file paths and URLs in tool output to be clickable.
Type of change
What does this PR do?
Makes file paths and URLs clickable in TUI tool output using OSC8 hyperlinks.
Added a
TextWithLinkscomponent that parses text for URLs and file paths and renders them as<a>tags (which opentui renders as OSC8 hyperlinks). AddedFilePathLinkfor converting paths tofile://URLs. Refactored the existingLinkcomponent to use native<a>tags instead ofonMouseUp+open().Wired it into the tool renderers — Read, Write, Edit, Glob, Grep, List now show clickable file paths. Bash output passes through
TextWithLinksso URLs and paths there are clickable too.BlockTooltitle prop now accepts JSX so tool headers can contain links.How did you verify your code works?
bun test --timeout 30000)Screenshots / recordings
N/A — terminal feature, hard to screenshot OSC8 links. Clicking
Read src/foo.tsin tool output opens the file.Checklist