Phase 5 Complete: Advanced Read Operations with Excalidraw Support

- 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.
This commit is contained in:
2025-10-16 23:47:19 -04:00
parent aff7c6bd0a
commit 7e5a6a8c3c
8 changed files with 970 additions and 438 deletions

View File

@@ -140,3 +140,38 @@ export interface ListResult {
hasMore: boolean;
nextCursor?: string;
}
// Phase 5: Advanced Read Operations Types
export interface ParsedNote {
path: string;
hasFrontmatter: boolean;
frontmatter?: string;
parsedFrontmatter?: Record<string, any>;
content: string;
contentWithoutFrontmatter?: string;
}
/**
* Excalidraw drawing file metadata
* Returned by read_excalidraw tool
*/
export interface ExcalidrawMetadata {
/** File path */
path: string;
/** True if file is a valid Excalidraw drawing */
isExcalidraw: boolean;
/** Number of drawing elements (shapes, text, etc.) */
elementCount?: number;
/** True if drawing contains compressed/embedded image data */
hasCompressedData?: boolean;
/** Drawing metadata including appState and version */
metadata?: {
appState?: Record<string, any>;
version?: number;
[key: string]: any;
};
/** Preview text extracted from text elements section (when includePreview=true) */
preview?: string;
/** Full compressed drawing data (when includeCompressed=true) */
compressedData?: string;
}