MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / readPrimaryNotesLocation

Function readPrimaryNotesLocation

apps/desktop/src/mcp/vault-ops.ts:122–140  ·  view source on GitHub ↗
(root: string)

Source from the content-addressed store, hash-verified

120 * that succeeded.
121 */
122export async function readPrimaryNotesLocation(root: string): Promise<PrimaryNotesLocation> {
123 const [rootContent, inboxNotes, explicit] = await Promise.all([
124 countLooseRootContent(root),
125 countMdFilesRecursively(path.join(root, 'inbox')),
126 readExplicitPrimaryNotesLocation(root)
127 ])
128
129 // Strong layout signal — root has user-organized content (loose
130 // .md files, custom subfolders). The vault is laid out flat.
131 if (rootContent >= 1) return 'root'
132
133 // Strong layout signal — only inbox/ has notes, root is empty or
134 // just system folders. Classic ZenNotes lifecycle layout.
135 if (inboxNotes >= 1) return 'inbox'
136
137 // Ambiguous (empty vault). Trust the explicit setting if present,
138 // otherwise default to inbox (matches a fresh ZenNotes install).
139 return explicit ?? 'inbox'
140}
141
142/** The absolute directory that holds notes for a given top-level
143 * folder, taking the vault's primaryNotesLocation into account. */

Callers 2

folderRootFunction · 0.85
server.tsFile · 0.85

Calls 3

countLooseRootContentFunction · 0.85
countMdFilesRecursivelyFunction · 0.85

Tested by

no test coverage detected