Break up the monolithic useNoteActions hook (cc=37, 232 LoC, score 6.89) into:
- useTabManagement: owns tab state and all tab operations (score 9.53)
- mockFrontmatterHelpers: extracted and simplified YAML manipulation (score 9.09+)
- useNoteActions: now focused on note creation and frontmatter operations (score 9.22)
Key improvements:
- Extracted entryMatchesTarget() to reduce wikilink matching complexity
- Deduplicated replaceKeyInLines/removeKeyFromLines into processKeyInLines
- Converted buildNewEntry to use object param (was 5 positional args)
- Overall complexity reduced from cc=37 to cc=11 in useNoteActions
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When viewing a commit diff from git history, the GitBranch toggle in the
breadcrumb bar was disabled if the file had no unstaged changes, leaving
no way to return to the editor. Now the toggle stays active whenever
diffMode is true, and a visible "Back to editor" button appears at the
top of the diff view for better discoverability.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Two frames added to design/git-history.pen:
- "Git History — Commit List": shows inspector panel with clickable
hashes (primary color, underlined), relative dates, commit messages,
and author name (muted, small) on each commit row
- "Git History — Diff Open": shows diff view with breadcrumb bar
displaying file path and commit badge, plus colored diff lines
(red for removed, green for added)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add get_file_diff_at_commit Rust command to show diff at a specific commit
- Make shortHash in GitHistoryPanel a clickable button that opens DiffView
- Show author name below commit message (small, muted)
- Remove disabled "View all revisions" button
- Wire onLoadDiffAtCommit through Editor → Inspector → App.tsx
- Add mock handler for get_file_diff_at_commit in browser mode
- Fix pre-existing missing `order` field on trashed mock entries
- Update Inspector tests for new behavior
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Set the window backgroundColor to #F7F6F3 (same as --sidebar CSS variable)
in the Tauri window config. With titleBarStyle "Transparent", this makes
the native macOS title bar area match the sidebar background color instead
of defaulting to white.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add `truncate` and `min-w-0` Tailwind classes to property value elements
in the properties panel so long text is shown on a single line with
ellipsis. The full value is visible via the title attribute on hover.
Affected elements:
- EditableValue display span (main property values)
- Status pill in DynamicPropertiesPanel
- Type button in DynamicPropertiesPanel
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add archive/unarchive toggle button to the BreadcrumbBar (Archive icon
for normal notes, ArrowUUpLeft icon for archived notes). Add cmd+e
keyboard shortcut to toggle archive state of the active note.
Refactored useAppKeyboard to use action map pattern (reduces cyclomatic
complexity) and extracted BreadcrumbActions from BreadcrumbBar to split
rendering complexity across two functions.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The Inspector aside element was missing flex-1, so it only grew to
its content height instead of filling the full height of its parent
flex-col container.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Changed the sidebar section header from a button-style "Customize sections"
label with inline icon to a clean "Sections" heading with the settings icon
pushed to the far right. The settings icon still toggles the customize
popover — no functionality change.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Tests verify:
- Trash button shows for non-trashed notes
- Restore button shows for trashed notes
- onClick callbacks fire correctly for both
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Added trash icon button in breadcrumb bar for non-trashed notes
- Added restore (arrow counter-clockwise) button for trashed notes
- Trash button sets trashed=true and trashed_at in frontmatter
- Restore button removes trashed/trashed_at from frontmatter
- Added Cmd+Delete keyboard shortcut to trash active note
- Wired handlers through Editor -> App with vault entry updates
- Toast notifications for trash/restore actions
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Added 3 trashed notes with trashed_at dates in frontmatter:
- note-old-meeting-notes.md (trashed 2026-02-10)
- note-deprecated-workflow.md (trashed 2026-01-15)
- experiment-failed-podcast.md (trashed 2026-02-05)
These provide realistic test data for the trash feature in the demo vault.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix toggleSection to account for default collapsed state
(collapsed[type] ?? true, not just !prev[type])
- Update tests to expand sections before asserting item visibility
(sections start collapsed by default)
- Add tests for section ordering by Type entry order property
- Add test for drag handle rendering on section headers
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Wrap sidebar section groups in @dnd-kit sortable context
- Add grip-vertical drag handle visible on hover of section headers
- Sort sections by `order` property from Type document entries
- On drag end, compute new sequential order values and persist to
each Type document's frontmatter via handleReorderSections
- Add onReorderSections callback from Sidebar → App.tsx → vault
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add `order: number | null` to VaultEntry (TS) and VaultEntry (Rust)
- Add order to Frontmatter struct and SKIP_KEYS in vault.rs
- Update all mock Type documents with order values (0-10)
- Add order: null to all non-Type mock entries and test fixtures
- Install @dnd-kit/core, @dnd-kit/sortable, @dnd-kit/utilities
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Tests cover: rendering all tabs, draggable attribute, reorder on DnD,
no-op when dropping in same position, and tab switching on click.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- TabBar: HTML5 drag-and-drop on tab elements (grab/grabbing cursor,
0.5 opacity on dragged tab, 2px primary-color drop indicator)
- useNoteActions: handleReorderTabs splices tab array, saves order
to localStorage under "laputa-tab-order" key
- Tab order auto-persists on every change; restored on mount
- Wired through Editor → App props chain
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Three frames showing drag interaction flow:
1. Default sidebar with grip-vertical drag handles on section headers
2. Mid-drag state with blue drop indicator line and floating section overlay
3. After-drop state showing reordered sections
Order persisted as "order" property in Type document frontmatter.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Three frames added to design/draggable-tabs.pen:
1. Default state — tabs with grab cursor hint
2. Dragging state — tab at 0.5 opacity, 2px primary-color drop indicator
3. After drop — reordered tabs, localStorage persistence note
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds purge_trash(vault_path) that scans all .md files, reads the
"Trashed at" frontmatter date, and deletes files older than 30 days.
Registered as a Tauri command and called automatically on app startup
(defaults to ~/Laputa vault). Includes 7 tests covering boundary
conditions, nested dirs, and datetime formats.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
All MOCK_ENTRIES now have realistic createdAt timestamps (always before
modifiedAt). Stock Screener status changed to 'Paused' for sort-by-status
testing variety.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Tests for getSortComparator (6 tests):
- Sort by modified date descending
- Sort by created date descending (with fallback)
- Sort by title alphabetically
- Sort by status with priority ordering
- Status sort with modified-date tiebreaker
Tests for NoteList sort controls (6 tests):
- Sort button visible in flat list header
- Sort dropdown per relationship subsection
- Sort menu opens with all options
- Sort order changes on option selection
- Menu closes after selection
- Relationship subsection sorting works
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Each relationship subsection header now has a sort dropdown control
(ArrowsDownUp icon + current sort label). Users can choose to sort by:
- Modified date (default, newest first)
- Created date (newest first)
- Title (alphabetical A-Z)
- Status (Active > Paused > Done > Finished)
The sort control also appears in the main note list header for flat
list views. Sort preferences are persisted per group in localStorage.
Also updates mock data with varied createdAt/status values for testing.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add unit test verifying content blocks are applied via deferred microtask
(not synchronously in useEffect). Convert debug E2E test into a proper
regression test that checks editor content appears after clicking a note
and no flushSync errors are logged.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Shows sort control UI for relationship subsection headers:
- Default state: sort icon + current sort label in header bar
- Open state: dropdown popover with options (Modified, Created, Title, Status)
- Selected option highlighted with check icon
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>