Skip to content

feat: add directory creation from FileTree context menu#333

Merged
rjroy merged 2 commits intomainfrom
feat/328-add-dir
Jan 17, 2026
Merged

feat: add directory creation from FileTree context menu#333
rjroy merged 2 commits intomainfrom
feat/328-add-dir

Conversation

@rjroy
Copy link
Copy Markdown
Owner

@rjroy rjroy commented Jan 17, 2026

Summary

  • Add "Add Directory" option to the FileTree context menu for directories
  • Create reusable InputDialog component for text input with validation
  • Implement backend createDirectory function with name validation (alphanumeric, hyphens, underscores only)
  • Add WebSocket message schemas for create_directory and directory_created

Test plan

  • All existing tests pass (./git-hooks/pre-commit.sh)
  • New tests for createDirectory function (14 tests)
  • New tests for protocol schemas (15 tests)
  • Manual test: Right-click a directory → "Add Directory" → enter valid name → directory appears
  • Manual test: Verify invalid names (spaces, special chars) show validation error
  • Manual test: Verify duplicate directory name shows error

Closes #328

🤖 Generated with Claude Code

Add "Add Directory" option to the context menu when right-clicking
directories in the file browser. Users can create new subdirectories
with names restricted to alphanumeric characters, hyphens, and
underscores to maintain vault structure consistency.

Changes:
- Add create_directory/directory_created WebSocket message schemas
- Add createDirectory function with name validation and security checks
- Create reusable InputDialog component for text input with validation
- Add FolderPlus icon and menu option to FileTree context menu
- Wire up BrowseMode to refresh directory listing after creation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 17, 2026

Codecov Report

❌ Patch coverage is 98.59649% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
frontend/src/components/InputDialog.tsx 96.42% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

Adds test coverage for:
- InputDialog component (32 tests covering rendering, accessibility, validation, user interactions)
- FileTree "Add Directory" functionality (11 tests covering context menu, dialog, validation)
- BrowseMode directory_created message handling (3 tests for WebSocket integration)
- browser-handlers handleCreateDirectory (10 tests covering success, error codes, no vault)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@rjroy rjroy merged commit 4944ac9 into main Jan 17, 2026
2 checks passed
@rjroy rjroy deleted the feat/328-add-dir branch January 17, 2026 16:11
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.

Add Directory option

1 participant