refactor(vault): split notes.ts into focused files behind facade (Phase 3.1) - #232
Merged
Conversation
Per .claude/plans/tech-debt-remediation.md Phase 3.1. The 1,546-line notes.ts with 43 exports is split into 6 focused files. notes.ts stays as a re-export facade so none of the 15 consumer files need updating. - notes-io.ts (55 LOC): path utilities — getNotesDir, toAbsolutePath, toRelativePath, emitNoteEvent - notes-crud.ts (733 LOC): CRUD + folders + utilities + import (createNote, updateNote, deleteNote, getNoteById, getFileById, getNoteByPath, noteExists, folder management, openExternal, revealInFinder, importFiles, all 14 exported types) - notes-queries.ts (213 LOC): cross-note queries (listNotes, getTagsWithCounts, getNoteLinks, noteToListItem, extractAllLinkContexts) — pulled out to keep notes-crud under the 800-line pre-commit guardrail - notes-rename.ts (189 LOC): renameNote, moveNote - notes-versions.ts (244 LOC): snapshots + version history (createSnapshot, maybeCreateSignificantSnapshot, getVersionHistory, getVersion, restoreVersion + 3 threshold constants) - notes.ts (13 LOC): facade re-exporting all 43 original exports Type-only imports resolve the notes-crud ↔ notes-versions cycle. Existing notes.test.ts (1,220 LOC, uses namespace import) runs unchanged.
h4yfans
force-pushed
the
debt/phase-3-u1-vault-notes-split
branch
from
April 16, 2026 14:02
7bb6768 to
7b2f093
Compare
3 tasks
h4yfans
added a commit
that referenced
this pull request
May 6, 2026
Per .claude/plans/tech-debt-remediation.md Phase 3.1. The 1,546-line notes.ts with 43 exports is split into 6 focused files. notes.ts stays as a re-export facade so none of the 15 consumer files need updating. - notes-io.ts (55 LOC): path utilities — getNotesDir, toAbsolutePath, toRelativePath, emitNoteEvent - notes-crud.ts (733 LOC): CRUD + folders + utilities + import (createNote, updateNote, deleteNote, getNoteById, getFileById, getNoteByPath, noteExists, folder management, openExternal, revealInFinder, importFiles, all 14 exported types) - notes-queries.ts (213 LOC): cross-note queries (listNotes, getTagsWithCounts, getNoteLinks, noteToListItem, extractAllLinkContexts) — pulled out to keep notes-crud under the 800-line pre-commit guardrail - notes-rename.ts (189 LOC): renameNote, moveNote - notes-versions.ts (244 LOC): snapshots + version history (createSnapshot, maybeCreateSignificantSnapshot, getVersionHistory, getVersion, restoreVersion + 3 threshold constants) - notes.ts (13 LOC): facade re-exporting all 43 original exports Type-only imports resolve the notes-crud ↔ notes-versions cycle. Existing notes.test.ts (1,220 LOC, uses namespace import) runs unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
vault/notes.tsgod-file (43 exports) into 6 focused files behind a re-export facade../noteskeep working (facade preserves public API).Per
.claude/plans/tech-debt-remediation.mdPhase 3.1.Split
notes-io.tsgetNotesDir,toAbsolutePath,toRelativePath,emitNoteEvent)notes-crud.tsnotes-queries.tslistNotes,getTagsWithCounts,getNoteLinks+ helpers)notes-rename.tsrenameNote,moveNotenotes-versions.tsnotes.tsnotes-queries.tswas pulled out to keepnotes-crud.tsunder the 800-line pre-commit guardrail (set by P.1 / P.2 of the tech-debt plan). Clean architectural grouping — cross-note reads cluster naturally together.Why
Test plan
pnpm typecheck:nodepasses on the splitnotes.test.ts(1,220 LOC, uses* as noteVaultnamespace import) survives unchangedvault/notesscope)