Skip to content

fix(editor): resolve bare filenames and show picker for ambiguous matches #37

Merged
bbsngg merged 3 commits intomainfrom
feat/chat-file-preview
Mar 17, 2026
Merged

fix(editor): resolve bare filenames and show picker for ambiguous matches #37
bbsngg merged 3 commits intomainfrom
feat/chat-file-preview

Conversation

@MarkSiqiZhang
Copy link
Copy Markdown
Collaborator

Summary

  • When AI mentions a file by bare name (e.g. __init__.py, index.js), the backend now searches the project tree via BFS instead of returning 404
  • If exactly one match is found, the file opens automatically; if multiple matches exist, a disambiguation picker UI is shown
  • Partial relative paths (e.g. src/main.tsx when the actual path is frontend/src/main.tsx) are also resolved by suffix-matching against the
    project tree
  • BFS follows symlinks (fixes .claude/skills/*) and only skips node_modules, .git, dist, build
  • Extensionless files like Dockerfile, Makefile, Procfile are recognized as clickable links in chat messages
  • 404 errors show "File not found" instead of raw HTTP status
  • Path separators are normalized for Windows compatibility

Test plan

  • Click a bare filename in chat that exists once → auto-opens
  • Click a bare filename with multiple matches (e.g. __init__.py) → picker shown, selecting one opens it
  • Click a partial relative path (e.g. src/main.tsx) that doesn't match the root but exists deeper → auto-resolves
  • Click a full relative path (server/index.js) → opens directly, no search
  • Click a root file (package.json) → opens directly
  • Click Dockerfile or Makefile in chat → highlighted as clickable, opens correctly
  • Click a nonexistent filename → shows "File not found" error
  • Picker is scrollable with long lists and has a close button

@MarkSiqiZhang MarkSiqiZhang changed the title feat(editor): resolve bare filenames and show picker for ambiguous matches fix(editor): resolve bare filenames and show picker for ambiguous matches Mar 17, 2026
@bbsngg bbsngg merged commit 0fbbb9b into main Mar 17, 2026
1 check passed
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.

2 participants