ClaudeMods
☰
ZH-CN
● 0 人在线 · 浏览 0 次
赞助提交作品
GitHub 仓库 · 发布者 alex2481kobe

link

点击回复中的文件路径,Finder 会打开并选中该文件。

alex2481kobe@alex2481kobe

alex2481kobe/claude-mods/tree/main/plugins/link

已翻译

关于这个 mod

Claude Code 会将文件路径以纯文本打印出来。使用此 mod 后,回复中存在于磁盘上的路径会变成链接:按下链接会在 Finder 中打开其所在文件夹并选中该文件;如果路径是文件夹,则直接打开该文件夹,并弹出提示说明打开的对象。它会在助手消息上使用 ui.render hook,找出类似路径的文本,根据工作阶层文件夹和主目录解析路径,再将存在的路径转换为 file:// 链接。按下链接会运行 open -R <file> 或 open <folder>。需要在终端中支持 mod 的 Claude Code、macOS,以及支持超链接(OSC 8)的终端,例如 Ghostty 或 iTerm2。通过 /plugin marketplace add alex2481kobe/claude-mods 和 /plugin install link@claude-mods 安装。

安装

请先查看作者 README 确认 marketplace 和插件名称;命令可能随仓库结构改变。

claude plugin marketplace add alex2481kobe/claude-mods
claude plugin install link
原文 / README

link

Click a file path in a reply and Finder opens with it selected.

Claude Code prints file paths as plain text. With this mod, a path in a reply that exists on disk becomes a link: pressing it shows a file selected in its folder in Finder, or opens a folder as itself, and a toast says which.

Requirements

  • Claude Code with mods, in the terminal (the reply is only changed there)
  • macOS: it runs open and open -R
  • A terminal with hyperlinks (OSC 8), such as Ghostty or iTerm2. Apple Terminal has none: there Claude Code writes each link's file:// address after it, so a path shows twice, and pressing it does not always open it

Install

/plugin marketplace add alex2481kobe/claude-mods
/plugin install link@claude-mods

How it works

  • A ui.render hook on assistant messages finds path-like text, resolves it against the session's folder and home, and keeps only paths that exist.
  • Those paths are turned into file:// links in the reply's Markdown. A folder's URL ends in a slash, which is how a press tells it from a file.
  • Pressing a link runs open -R <file> or open <folder> and toasts the result, or the error if it failed.
  • A reply longer than 10000 characters, or with no existing path, keeps the engine's own drawing.

更多类似作品