Skip to content

feat(desktop): create notes & folders from the left nav (⌘N / ⇧⌘N, right-click) - #59

Merged
samkeen merged 1 commit into
mainfrom
claude/desktop-file-folder-creation-i2avbu
Jul 19, 2026
Merged

feat(desktop): create notes & folders from the left nav (⌘N / ⇧⌘N, right-click)#59
samkeen merged 1 commit into
mainfrom
claude/desktop-file-folder-creation-i2avbu

Conversation

@samkeen

@samkeen samkeen commented Jul 19, 2026

Copy link
Copy Markdown
Contributor
  • b2-core: Vault::create_note — the model-free create sibling of add_note
    (shared file write + project_file, the same posture as Vault::write): the
    new note is projected immediately (tree / keyword search / graph) and its
    chunks join the DB-derived pending set for the next embed pass. add_note
    is unchanged; both share write_new_note.
  • b2-desktop: thin create_note command (fake vault, outside the embed slot),
    AddTargetExists/AddDestination user-message mappings, command-layer tests.
  • ui: New note / New folder icons in the tree head with ⌘N / ⇧⌘N shortcuts,
    contextual on the selection (the open document's folder, or the last folder
    clicked/right-clicked, tracked as state.selectedDir). The name is typed into
    an inline input row in the tree: Enter creates and opens the note in edit
    mode, blur creates quietly, Escape cancels; on a refusal the input stays up
    with the typed name. The tree's right-click menu is taken over wholesale
    (New note / New folder targeting the row under the cursor). Folders are
    staged UI state (pendingDirs) that materialize on disk with their first
    note — create_note makes parent dirs, so no empty dir the index-derived
    tree couldn't list is ever written. The tree pane render is memoized (the
    note-pane pattern) so an unrelated repaint can't eat the typed name.

Auto-index: a created note is projected at creation and embeds through the
existing autosave → trailing-embed pipeline once content is typed.

Co-Authored-By: Claude Fable 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01RybX9LpMF7FvaJRgpcs3Cy

Summary by CodeRabbit

  • New Features

    • Create empty notes without requiring an embedding model.
    • Added “New note” and “New folder” actions to the file tree and context menu.
    • New folders can be staged in the interface before being saved.
    • Added keyboard shortcuts and inline creation controls for notes and folders.
    • File-tree selection and navigation now persist more reliably during updates.
  • Bug Fixes

    • Prevented accidental overwrites and invalid destination paths.
    • Improved error messages for existing notes and invalid names.
    • Context menus now remain within the visible window.

…ght-click)

- b2-core: Vault::create_note — the model-free create sibling of add_note
  (shared file write + project_file, the same posture as Vault::write): the
  new note is projected immediately (tree / keyword search / graph) and its
  chunks join the DB-derived pending set for the next embed pass. add_note
  is unchanged; both share write_new_note.
- b2-desktop: thin create_note command (fake vault, outside the embed slot),
  AddTargetExists/AddDestination user-message mappings, command-layer tests.
- ui: New note / New folder icons in the tree head with ⌘N / ⇧⌘N shortcuts,
  contextual on the selection (the open document's folder, or the last folder
  clicked/right-clicked, tracked as state.selectedDir). The name is typed into
  an inline input row in the tree: Enter creates and opens the note in edit
  mode, blur creates quietly, Escape cancels; on a refusal the input stays up
  with the typed name. The tree's right-click menu is taken over wholesale
  (New note / New folder targeting the row under the cursor). Folders are
  staged UI state (pendingDirs) that materialize on disk with their first
  note — create_note makes parent dirs, so no empty dir the index-derived
  tree couldn't list is ever written. The tree pane render is memoized (the
  note-pane pattern) so an unrelated repaint can't eat the typed name.

Auto-index: a created note is projected at creation and embeds through the
existing autosave → trailing-embed pipeline once content is typed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RybX9LpMF7FvaJRgpcs3Cy
@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d1204439-dcbb-4987-91b0-343fdb061b9e

📥 Commits

Reviewing files that changed from the base of the PR and between 92b8b31 and 2237f60.

📒 Files selected for processing (18)
  • CLAUDE.md
  • crates/b2-core/src/add.rs
  • crates/b2-core/src/vault.rs
  • crates/b2-core/tests/add.rs
  • crates/b2-core/tests/explain.rs
  • crates/b2-desktop/CLAUDE.md
  • crates/b2-desktop/src/commands.rs
  • crates/b2-desktop/src/error.rs
  • crates/b2-desktop/src/main.rs
  • ui/package.json
  • ui/src/api.ts
  • ui/src/main.ts
  • ui/src/newentry.test.ts
  • ui/src/newentry.ts
  • ui/src/render.ts
  • ui/src/state.ts
  • ui/src/types.ts
  • ui/style.css

📝 Walkthrough

Walkthrough

Adds model-free note creation across the core vault, desktop IPC, and UI tree. Notes are projected without embedding, invalid destinations are reported, and the UI supports inline note or staged-folder creation.

Changes

Note creation flow

Layer / File(s) Summary
Core note creation
crates/b2-core/src/add.rs, crates/b2-core/src/vault.rs, crates/b2-core/tests/*
Separates file writing from ingestion and adds model-free create_note projection with validation and coverage.
Desktop command wiring
crates/b2-desktop/src/commands.rs, crates/b2-desktop/src/error.rs, crates/b2-desktop/src/main.rs
Exposes note creation through Tauri, registers the command, maps errors, and tests creation behavior.
Tree creation contracts and rendering
ui/src/state.ts, ui/src/types.ts, ui/src/newentry.ts, ui/src/render.ts, ui/src/api.ts, ui/style.css
Adds creation state, path utilities, staged-directory rendering, context-menu output, IPC types, API wiring, styling, and utility tests.
Tree creation interactions
ui/src/main.ts, ui/package.json
Adds inline creation, folder staging, menu and keyboard actions, selection tracking, render preservation, and vault-switch resets.

Estimated code review effort: 4 (Complex) | ~60 minutes

Suggested reviewers: claude

Poem

I thumped a path, the note sprang bright,
No model needed, just write and light.
Folders wait in staged-up rows,
A little tree where creation grows.
Hop, hop—IPC carries the tune!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/desktop-file-folder-creation-i2avbu

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@samkeen
samkeen merged commit 232d16a into main Jul 19, 2026
1 check was pending
@samkeen
samkeen deleted the claude/desktop-file-folder-creation-i2avbu branch July 19, 2026 02:14
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