Integrate Obsidian metadataCache across extraction and tooling

Replaces regex-based parsing of frontmatter and headings with
Obsidian's metadataCache where available, falling back to regex
when the cache is unavailable. Propagates App dependency through
constructors to enable cache access.

Key changes:
- ContentExtractor accepts optional cache for frontmatter/headings
- ToolExecutor uses cache for section replacement and frontmatter
- NoteContextBuilder resolves titles/tags from cache
- VaultVectorStore passes cache through indexing pipeline
- AutoTagger checks cache for existing tags instead of content
- Mock updated with metadataCache stubs for tests
This commit is contained in:
2026-05-20 20:36:47 +02:00
parent 3c7c4d58bb
commit 106abfa718
13 changed files with 419 additions and 139 deletions
+8 -1
View File
@@ -14,6 +14,9 @@ interface MockVault {
delete: (file: any) => Promise<void>;
}
interface MockApp {
metadataCache: {
getFileCache: jest.Mock;
};
// Mock app properties if needed
}
interface MockNotice {
@@ -53,7 +56,11 @@ describe('ToolExecutor', () => {
rename: jest.fn().mockResolvedValue(undefined),
delete: jest.fn().mockResolvedValue(undefined),
};
mockApp = {} as MockApp;
mockApp = {
metadataCache: {
getFileCache: jest.fn().mockReturnValue(null),
},
} as MockApp;
executor = new ToolExecutor(mockVault as unknown as any, mockApp as unknown as any);
jest.clearAllMocks();
});