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

Function readExplicitPrimaryNotesLocation

apps/desktop/src/mcp/vault-ops.ts:48–61  ·  view source on GitHub ↗

Read `.zennotes/vault.json` if present and pull out an explicit * primaryNotesLocation setting. Returns null when the file is * missing, unreadable (TCC), malformed, or doesn't include the * field — callers fall back to layout inspection.

(
  root: string
)

Source from the content-addressed store, hash-verified

46 * missing, unreadable (TCC), malformed, or doesn't include the
47 * field — callers fall back to layout inspection. */
48async function readExplicitPrimaryNotesLocation(
49 root: string
50): Promise<PrimaryNotesLocation | null> {
51 const settingsPath = path.join(root, INTERNAL_VAULT_DIR, VAULT_SETTINGS_FILE)
52 try {
53 const raw = await fs.readFile(settingsPath, 'utf8')
54 const parsed = JSON.parse(raw) as { primaryNotesLocation?: unknown }
55 if (parsed.primaryNotesLocation === 'root') return 'root'
56 if (parsed.primaryNotesLocation === 'inbox') return 'inbox'
57 return null
58 } catch {
59 return null
60 }
61}
62
63/** How many "non-system" things sit directly at the vault root.
64 * Loose .md files and ordinary subfolders both count — both are

Callers 1

readPrimaryNotesLocationFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected