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

Function folderOf

apps/desktop/src/mcp/vault-ops.ts:339–349  ·  view source on GitHub ↗
(root: string, abs: string)

Source from the content-addressed store, hash-verified

337}
338
339function folderOf(root: string, abs: string): NoteFolder | null {
340 const rel = toPosix(path.relative(root, abs))
341 if (!rel || rel.startsWith('..')) return null
342 const top = rel.split('/')[0]
343 if (FOLDERS.includes(top as NoteFolder)) return top as NoteFolder
344 // Root-level files belong to inbox in `primaryNotesLocation: 'root'`
345 // mode. Hidden names (.zennotes, attachments, system folders) are
346 // not notes — return null so they're rejected.
347 if (!top || top.startsWith('.') || HIDDEN_PRIMARY_ROOT_NAMES.has(top)) return null
348 return 'inbox'
349}
350
351/* ---------- Markdown parsing ----------------------------------------- */
352

Callers 11

readNoteFunction · 0.70
writeNoteFunction · 0.70
renameNoteFunction · 0.70
folderSubpathOfFunction · 0.70
moveNoteFunction · 0.70
duplicateNoteFunction · 0.70
toggleTaskFunction · 0.70
appendToNoteFunction · 0.70
prependToNoteFunction · 0.70
replaceInNoteFunction · 0.70
insertAtLineFunction · 0.70

Calls 1

toPosixFunction · 0.70

Tested by

no test coverage detected