Repository navigation
feat(links): make .diff and .patch paths clickable - #644
Conversation
An agent that writes a diff for review prints a path such as /tmp/.../scratchpad/resolution.diff, and that path rendered as plain text because the link patterns had no diff or patch extension. The attachment allowlist already serves both as inert text/plain, so only the two link patterns in constants.js change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks @irisitymichaelgrundberg, this is a nice small fix: paths ending in I traced every click path and it holds up. The out-of-workspace case goes through the attachment routes, which already allowlist both extensions ( One bonus you did not mention: the hard-wrap joiner reads its extension list off the same pattern, so a long scratchpad One thing changed since you opened this: #621 landed and added
This goes in with the next release. |
…ckable Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Merged and shipped in 1.43.0. Thanks @irisitymichaelgrundberg! I resolved the |
What
Paths ending in
.diffor.patchare now clickable in the terminal and in the response viewer, the same as.txtor.jsonpaths.Why
Claude often writes a diff for review into its scratchpad and prints the path, for example
/tmp/claude-1000/<project>/<session>/scratchpad/resolution.diff. That path rendered as plain text, because neither file-path link pattern had adifforpatchextension. Over a remote connection, a plain-text path leaves no easy way to read the file.The server side already handles both extensions.
TEXT_ATTACHMENT_EXTENSIONSisEDITABLE_EXTENSIONS, which listsdiffandpatch, so an out-of-workspace path registers as a text attachment and is served as inerttext/plainwithnosniff.Change
src/web/public/constants.jsaddsdiff|patchto the extension group ofFILE_PATH_LINK_PATTERNand ofRELATIVE_FILE_PATH_LINK_PATTERN. The two must stay equal, and an existing test pins that.test/link-provider-regex.test.tsadds a scratchpad.diffpath and a.patchpath to the cases the rooted pattern must link.Testing
npm run typecheck,lint,format:check,check:frontend-syntaxandcheck:browser-excludespass.npm testpasses on a cleannpm ciof this branch.POST /api/sessions/:id/attachmentsaccepted a/tmp/.../resolution.diff, and its/rawroute returned200withtext/plain; charset=utf-8andnosniff.findFilePathLinks()linked the full path out of the sentence... scratchpad/resolution.diff., without the trailing full stop, and linked a relative./fixes/one.patch.🤖 Generated with Claude Code