debug(obsidian): add logging to diagnose nested folder display issue

- Add debug logging to getVaultFiles() to show file counts
- Add logging to listAllNotes() to show processing details
- Add logging to buildFolderTree() to trace folder creation
- Filter .md files in getVaultFiles() for better performance
- Log sample file paths to help diagnose API response format

This will help identify why nested folders aren't appearing in the
folder tree browser.
This commit is contained in:
Claude 2025-11-14 04:50:05 +00:00
parent 8561eee75d
commit adb04d2e43
No known key found for this signature in database
2 changed files with 24 additions and 1 deletions

View file

@ -79,7 +79,15 @@ const ObsidianBridge = (() => {
}
const data = await response.json();
return data.files || [];
const files = data.files || [];
// Filter to only .md files
const mdFiles = files.filter(f => f.endsWith(".md"));
INFO && console.log(`getVaultFiles: Found ${files.length} total files, ${mdFiles.length} markdown files`);
DEBUG && console.log("Sample files:", mdFiles.slice(0, 10));
return mdFiles;
} catch (error) {
ERROR && console.error("Failed to get vault files:", error);
throw error;
@ -435,6 +443,8 @@ Add your lore here...
const allFiles = await getVaultFiles();
const notes = [];
INFO && console.log(`listAllNotes: Processing ${allFiles.length} files`);
for (const filePath of allFiles) {
try {
const content = await getNote(filePath);
@ -453,6 +463,10 @@ Add your lore here...
// Sort by path
notes.sort((a, b) => a.path.localeCompare(b.path));
INFO && console.log(`listAllNotes: Returning ${notes.length} notes`);
DEBUG && console.log("Sample note paths:", notes.slice(0, 5).map(n => n.path));
return notes;
}