Skip to content

feat: add rename file/directory option to FileTree context menu#338

Merged
rjroy merged 2 commits intomainfrom
feat/329-rename
Jan 17, 2026
Merged

feat: add rename file/directory option to FileTree context menu#338
rjroy merged 2 commits intomainfrom
feat/329-rename

Conversation

@rjroy
Copy link
Copy Markdown
Owner

@rjroy rjroy commented Jan 17, 2026

Summary

  • Add "Rename" option to FileTree context menu for files and directories
  • Automatically update all references in markdown files when renaming
  • Support both wikilinks [[name]] and markdown links [text](path)

Closes #329

Test plan

  • Right-click a file in FileTree, select "Rename", enter new name
  • Verify file is renamed and extension is preserved
  • Verify references in other .md files are updated
  • Right-click a directory, select "Rename", enter new name
  • Verify directory is renamed and contents are preserved
  • Verify references to files inside the directory are updated
  • Try invalid names (spaces, special characters) and verify validation
  • Run ./git-hooks/pre-commit.sh to verify all tests pass

🤖 Generated with Claude Code

@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 17, 2026

Codecov Report

❌ Patch coverage is 94.95549% with 17 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
frontend/src/components/FileTree.tsx 86.00% 7 Missing ⚠️
backend/src/reference-updater.ts 95.91% 6 Missing ⚠️
frontend/src/components/BrowseMode.tsx 81.81% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

rjroy and others added 2 commits January 17, 2026 09:17
Add ability to rename files and directories from the FileTree context menu.
When renaming, all references in markdown files are automatically updated
to point to the new location.

Features:
- Rename option in context menu for both files and directories
- File extensions are preserved automatically
- Name validation (alphanumeric, hyphen, underscore only)
- Automatic reference updating for wikilinks [[name]] and markdown links [text](path)
- Directory renames update all references to files inside

Changes:
- Add RenameFileMessage/FileRenamedMessage schemas to protocol
- Add renameFile() function to file-browser.ts
- Add reference-updater.ts module for scanning and updating links
- Add handleRenameFile handler and wire up in websocket-handler
- Add Rename option to FileTree context menu with InputDialog
- Handle file_renamed message in BrowseMode to refresh view

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds tests for:
- handleRenameFile in browser-handlers.test.ts (13 test cases)
- file_renamed message handling in BrowseMode.rename.test.tsx

Tests cover success scenarios, error handling (file not found, file exists,
path traversal, validation), and directory refresh after rename.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@rjroy rjroy merged commit e467df9 into main Jan 17, 2026
2 checks passed
@rjroy rjroy deleted the feat/329-rename branch January 17, 2026 17:19
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.

Rename file/directory option

1 participant