Repository navigation
Conversation
Scan the last completed assistant response for relative and POSIX paths with optional line and column suffixes, number them, and open one by typing its number from /paths or <leader>f. Files open in $VISUAL or $EDITOR at the requested line; directories open in the file manager, and launchable file types are never handed to the OS default handler.
There was a problem hiding this comment.
The picker works as described. I ran it from source with the simulated model. /paths numbered the paths in the last response, typing 2 opened src/app.ts through $EDITOR, and a missing rooted path gets a number. The scanner and editor tests pass (25 pass, 1 skip), and tsc -b is clean.
Public API: this adds the /paths slash command and the session.file_links keybind (default <leader>f). Both are new, so it is backwards compatible. No SDK, server or plugin API changes.
The interaction is still under discussion in #60175: command name, keybinding, in-transcript numbering and the five-part split. No maintainer has decided it yet, so the design may still change.
Things worth fixing, in more detail inline:
- Editors that are not on the terminal list run while the TUI renderer is still active. That garbles the screen for any terminal editor missing from the list.
- GUI editors inherit the TUI's stdio, so anything they print lands in the TUI's terminal.
- Any
/wordcounts as an explicit path. Slash commands such as/goalget numbered and then report "Path not found". I saw this when I ran it.
Two smaller points. First, [1] tags are parsed by the Markdown renderer as reference links, so they show as underlined 1, not [1]. Second, mark() matches parts only by text:N and the text, not by message. An earlier message with exactly the same text would get tags too.
Treat only known GUI editors as detached so an unrecognized $EDITOR cannot write over the active TUI, and ignore the output of detached launches.
Require a file extension, a relative token, or an existing first directory before numbering a missing explicit path, and reject bare roots, so prose like /goal or /api/users no longer reports as a broken path.
Key detected parts by message so an earlier response with identical text stays untagged, and write rendered tags as [[n]] so conceal mode keeps the brackets instead of turning them into link markup.
|
Both smaller points are fixed in 56ab60a:
Inline threads have replies with the commit for each fix. Screenshots and the PR body are refreshed too. Focused tests: 26 pass, 4 skip, 0 fail. Full TUI suite: 1564 pass, 19 skip, 7 fail, where all seven are the pre-existing Windows symlink |
There was a problem hiding this comment.
All three earlier points are addressed:
- Editors that are not known GUI editors now suspend the renderer.
- GUI editors start detached, with stdio ignored.
- A missing explicit path is numbered only when it has an extension, is relative, or its first directory exists, so
/goaland/api/usersstay plain text.
Tags are now scoped to the last response by message ID and render as [1]. I checked this again in the TUI: /goal is no longer tagged, /tmp/not-there.md still is, and an unknown $EDITOR opens the file with the TUI suspended and then restored. The scanner, editor and new path-links tests pass (29 pass, 1 skip), and tsc -b is clean.
The public API has not changed since the last review: it adds the /paths command and the session.file_links keybind (<leader>f), which is backwards compatible. Nothing new worth blocking on. The interaction is still being discussed in #60175.
|
All three review points are fixed in
Head This is ready for maintainer review. The open interaction questions (command name, |



This is part 1 of 5. Part 2 adds multi-select, part 3 recognizes more path forms (Windows and UNC paths,
file://URLs, quoted paths, Markdown links, inline code), part 4 styles the tags with red selection dots, and part 5 adds a storybook story. Parts 2 to 5 open as this one merges, so each PR has a clean diff againstdev.Issue for this PR
Part of #60175. The final part will close it. Related: #58242, #54816, #55769, #48609. This is keyboard driven, so it does not implement #58242 as filed. It does not change Markdown link handling (#55769) or tool header rendering (#48609).
Type of change
What does this PR do?
Agent responses usually end with a list of files. In the TUI those paths are plain text, so getting to one means selecting and copying it. This adds
/paths(and<leader>f): it numbers the paths in the last completed assistant response and opens the number you type.It covers relative paths,
./and../, absolute POSIX paths, directories, and optional:lineor:line:columnsuffixes. Fenced code, inline code, Markdown links, URLs, and angle-bracket text are left alone. Relative names that do not exist stay plain text. A missing explicit path is numbered only when it is relative, names a file extension, or its first absolute directory exists, so a broken/tmp/report.mdcan be selected and reported while prose such as/goalor/api/usersstays plain text.Opening prefers
$VISUALor$EDITORand passes the line and column in the syntax the editor understands (--goto,file:line:column,+line). Without an editor, files go to the OS handler, directories to the file manager, and executable types are refused with a message instead of being launched. Terminal editors suspend the renderer until they exit. An editor that is not a known GUI editor is treated as a terminal editor, and known GUI editors launch detached with their output ignored, so neither can write over the TUI.Type a number to open it. If one number is a prefix of another (
1and12), the picker waits 600 ms before opening so typing12does not open1.backspaceedits the number,enteropens it, andesccloses the picker.Tags are inserted after the path with a space so the number reads as a tag and the Markdown stays intact. Rendered Markdown writes the tag as
[[1]], which conceals to a bracketed[1]with link styling; source mode keeps the plain[1]. Only the last completed assistant response is tagged, so an earlier response with identical text stays unchanged.The feature is behind a command and a keybinding, so it adds no work to the normal transcript path until the picker is opened.
Worked example. The response ends with:
Running
/pathsrenders:Typing
2openssrc/app.tsat line 12. When a number is also the prefix of a longer one, the bar previews the shorter path while the 600 ms timer runs, for example● Paths #1 · out/report.md · enter open · backspace edit · esc close.A missing explicit path such as
/tmp/not-there.mdgets a number. Choosing it showsPath not found: /tmp/not-there.md. A missing rooted directory without an extension, such as/tmp/not-there, is numbered only when its first directory exists.How did you verify your code works?
Automated, from the affected package:
That run: 26 pass, 4 skip, 0 fail. The skips are platform-specific editor tests that need a POSIX executable bit or a terminal editor. Typecheck passes.
Full TUI suite on this branch: 1564 pass, 19 skip, 7 fail. All seven failures are
EPERM: operation not permitted, symlinkin test fixtures that copy plugins or create watcher helpers, which this Windows machine cannot create without developer mode or elevation. The same seven tests fail identically on a cleanorigin/devcheckout here.Coverage added:
Manual check:
EDITORset to an editor. Terminal editors suspend the renderer until exit./paths./tmp/not-there.md: it gets a number and reports that it does not exist. Try/goalin prose: it stays plain text.Visual
Screenshots / recordings
Picker open on a completed response. Each existing path gets a number, and the bar shows the count and the available keys.
An invalid number reports
No path 9in the bar instead of opening anything.Checklist
Added by the opencode bot (AI-generated).
Related: #60175, #58242, #48609, #54816, #48648
Public API: adds the
/pathsslash command and thesession.file_linkskeybind (default<leader>f) (backwards compatible)