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:
@@ -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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user