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 )
| 46 | * missing, unreadable (TCC), malformed, or doesn't include the |
| 47 | * field — callers fall back to layout inspection. */ |
| 48 | async 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 |
no outgoing calls
no test coverage detected