Replace all `any` types with properly defined TypeScript interfaces and types throughout the codebase to improve type safety and eliminate type-related code quality issues.
Changes:
- Define ElectronSafeStorage interface for Electron's safeStorage API
- Create LegacySettings interface for settings migration in main.ts
- Define JSONValue, JSONRPCParams types for JSON-RPC protocol
- Define JSONSchemaProperty for tool input schemas
- Create YAMLValue type for frontmatter values
- Define FrontmatterValue type for adapter interfaces
- Update middleware to use proper Express NextFunction and JSONRPCResponse types
- Fix tool registry to handle args with proper typing (with eslint-disable for dynamic dispatch)
- Fix notifications to use proper types with eslint-disable where dynamic access is needed
- Add proper null safety assertions where appropriate
- Fix TFolder stat access with proper type extension
All type errors resolved. TypeScript compilation passes with --skipLibCheck.
Extended word count functionality to read operations (read_note, stat, list) to complement existing write operation support.
Changes:
- read_note: Now automatically includes wordCount when returning content (with withContent or parseFrontmatter options)
- stat: Added optional includeWordCount parameter with performance warning
- list: Added optional includeWordCount parameter with performance warning
- All operations use same word counting rules (excludes frontmatter and Obsidian comments)
- Best-effort error handling for batch operations
Technical details:
- Updated ParsedNote and FileMetadata type definitions to include optional wordCount field
- Added comprehensive test coverage (18 new tests)
- Updated tool descriptions with usage notes and performance warnings
- Updated CHANGELOG.md to document new features in version 1.1.0
Add automatic word count and link validation to create_note, update_note,
and update_sections operations to provide immediate feedback on note content
quality and link integrity.
Features:
- Word counting excludes frontmatter and Obsidian comments, includes all
other content (code blocks, inline code, headings, lists, etc.)
- Link validation checks wikilinks, heading links, and embeds
- Results categorized as: valid links, broken notes (note doesn't exist),
and broken headings (note exists but heading missing)
- Detailed broken link info includes line number and context snippet
- Human-readable summary (e.g., "15 links: 12 valid, 2 broken notes, 1 broken heading")
- Opt-out capability via validateLinks parameter (default: true) for
performance-critical operations
Implementation:
- New ContentUtils.countWords() for word counting logic
- Enhanced LinkUtils.validateLinks() for comprehensive link validation
- Updated create_note, update_note, update_sections to return wordCount
and linkValidation fields
- Updated MCP tool descriptions to document new features and parameters
- update_note now returns structured JSON instead of simple success message
Response format changes:
- create_note: added wordCount and linkValidation fields
- update_note: changed to structured response with wordCount and linkValidation
- update_sections: added wordCount and linkValidation fields
Breaking changes:
- update_note response format changed from simple message to structured JSON
Replace vault.delete() with fileManager.trashFile() to respect user's
trash preferences configured in Obsidian settings. This ensures deleted
files go to the user's configured trash location instead of being
permanently deleted without respecting system preferences.
Changes:
- src/tools/note-tools.ts: Replace vault.delete with fileManager.trashFile
in createNote (overwrite conflict) and deleteNote (permanent delete)
- tests/note-tools.test.ts: Update test expectations to check for
fileManager.trashFile calls instead of vault.delete
Addresses ObsidianReviewBot required issue #3.
Implements Task 10 from the implementation plan:
1. Updated NoteTools constructor to accept IVaultAdapter and IFileManagerAdapter
2. Created note-tools-factory.ts with factory function
3. Migrated all CRUD methods to use adapters:
- readNote: uses vault.read()
- createNote: uses vault.create(), vault.delete()
- createParentFolders: uses vault.createFolder()
- updateNote: uses vault.read(), vault.modify()
- deleteNote: uses vault.trash(), vault.delete()
- renameFile: uses fileManager.renameFile()
- readExcalidraw: uses vault.read()
- updateFrontmatter: uses vault.read(), vault.modify()
- updateSections: uses vault.read(), vault.modify()
4. Extended IVaultAdapter interface with modify(), delete(), and trash() methods
5. Implemented new methods in VaultAdapter
6. Updated ToolRegistry to use factory function
7. Kept app parameter temporarily for PathUtils dependency
8. All methods now use adapters instead of direct Obsidian API calls
9. Code compiles successfully
This change enables 100% test coverage by allowing full mocking of vault operations.
- Add get_folder_waypoint tool to extract waypoint blocks from folder notes
- Add is_folder_note tool to detect folder notes by basename or waypoint markers
- Implement waypoint edit protection in update_note to prevent corruption
- Create waypoint-utils.ts with helper functions for waypoint operations
- Add FolderWaypointResult and FolderNoteResult types
- Update ROADMAP.md and CHANGELOG.md with Phase 7 completion
- All manual tests passing
- Enhanced read_note tool with frontmatter parsing options
- parseFrontmatter option to separate frontmatter from content
- withFrontmatter and withContent options for flexible responses
- Returns structured ParsedNote JSON when parsing enabled
- Backward compatible (default behavior unchanged)
- New read_excalidraw tool for Excalidraw file metadata
- Detects compressed-json format (Excalidraw's actual format)
- Returns elementCount, hasCompressedData, metadata fields
- Handles compressed (base64) and uncompressed formats
- Preview text extraction from Text Elements section
- Optional full compressed data inclusion
- New frontmatter-utils.ts for YAML parsing
- Uses Obsidian's built-in parseYaml
- Extracts and parses frontmatter
- Handles edge cases (no frontmatter, malformed YAML)
- Excalidraw metadata parsing with compression detection
- Enhanced type definitions with JSDoc comments
- ParsedNote interface for structured note data
- ExcalidrawMetadata interface with detailed field docs
- Clear documentation of all fields and their purposes
- Comprehensive documentation
- IMPLEMENTATION_NOTES_PHASE5.md - Implementation details
- EXCALIDRAW_FIX_SUMMARY.md - Bug fix documentation
- EXCALIDRAW_TESTING_GUIDE.md - Testing instructions
- Updated CHANGELOG.md with all changes
- Updated ROADMAP.md marking Phase 5 complete
- Known limitation documented
- elementCount returns 0 for compressed files (expected)
- Decompression would require pako library (not included)
- hasCompressedData correctly identifies compressed files
- Preview text still available without decompression
- Added to roadmap as future enhancement
All manual tests passed. Phase 5 complete and production-ready.
Phase 2 - Breaking Changes (v2.0.0):
- Added typed result interfaces (FileMetadata, DirectoryMetadata, VaultInfo, SearchResult, SearchMatch)
- Unified parameter naming: list_notes now uses 'path' parameter (removed 'folder')
- Enhanced tool responses with structured JSON for all tools
- list_notes: Returns array of FileMetadata/DirectoryMetadata with full metadata
- search_notes: Returns SearchResult with line numbers, snippets, and match ranges
- get_vault_info: Returns VaultInfo with comprehensive statistics
- Updated all tool descriptions to document structured responses
- Version bumped to 2.0.0 (breaking changes)
Phase 2.1 - Post-Testing Fixes:
- Fixed root listing to exclude vault root folder itself (handles path '', '/', and isRoot())
- Fixed alphabetical sorting to be case-insensitive for stable ordering
- Improved directory metadata with better timestamp detection and error handling
- Fixed parent folder validation order (check if file before checking existence)
- Updated documentation with root path examples and leading slash warnings
- Added comprehensive test suite for sorting and root listing behavior
- Fixed test mocks to use proper TFile/TFolder instances
Tests: All 64 tests passing
Build: Successful, no errors