Skip to content

fix: normalize file paths in read tool output #12394

@scarf005

Description

@scarf005

Problem

When the read tool displays file paths outside the worktree, it shows confusing relative paths like:

read ../../../../../../home/scarf/foo/bar/baz.ts

This is hard to understand and makes the output noisy.

Solution

Modify the read tool to check if a file is within the worktree before deciding how to display the path:

  • Inside worktree: Show relative path (e.g., src/tool/read.ts)
  • Outside worktree: Show absolute path (e.g., /home/user/other/file.ts)

This improves UX by showing clean, understandable paths.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions