Skip to content

feat: preview verified local files and directories from chat - #736

Open
wyx20021207-create wants to merge 1 commit into
agegr:mainfrom
wyx20021207-create:feat/verified-local-path-preview
Open

feat: preview verified local files and directories from chat#736
wyx20021207-create wants to merge 1 commit into
agegr:mainfrom
wyx20021207-create:feat/verified-local-path-preview

Conversation

@wyx20021207-create

Copy link
Copy Markdown

Summary

  • Recognize local path references in Markdown text and inline code, without rewriting fenced code, math, or existing links.
  • Validate candidates using the existing authorized file metadata API before making them clickable. Nonexistent/inaccessible paths retain their original text.
  • Keep the original path label and neutral code-style background; show the resolved full path on hover and open it in the right-hand panel.
  • Support directory metadata and a right-panel directory listing, with navigation into child directories and files.
  • Recheck before opening, periodically refresh validation, deduplicate concurrent checks, and cap metadata request concurrency.
  • Keep the existing allowed-root and realpath checks; do not broaden filesystem access.

Testing

  • Markdown rendering, path validation, directory dispatch, and existing file-viewer regression tests pass.
  • npm run lint and TypeScript tsc --noEmit pass in the development checkout.
  • Ran npm test on Windows and compared it with an untouched upstream/main checkout at 0d1df12: both have the same 14 failing tests (including Windows symlink/shell limitations and existing component assertions). No additional failing tests were observed.
  • Production build and browser E2E were not run locally.

Manual verification

  1. Include an existing relative path or Windows absolute path in a chat response.
  2. Verify the original label remains visible, the full path appears on hover, and clicking opens the right panel.
  3. Include a nonexistent path or slash-separated function names and verify they remain plain text/code.
  4. Click an existing directory and navigate through its entries in the right panel.

This PR is independent of the composer image-preview feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant