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

Function backlinks

apps/desktop/src/mcp/vault-ops.ts:1181–1193  ·  view source on GitHub ↗
(root: string, rel: string)

Source from the content-addressed store, hash-verified

1179/* ---------- Backlinks ------------------------------------------------- */
1180
1181export async function backlinks(root: string, rel: string): Promise<NoteMeta[]> {
1182 const abs = resolveSafe(root, rel)
1183 const targetTitle = path.basename(abs, path.extname(abs)).toLowerCase()
1184 const all = await listNotes(root)
1185 const refs: NoteMeta[] = []
1186 for (const meta of all) {
1187 if (meta.path === toPosix(path.relative(root, abs))) continue
1188 if (meta.wikilinks.some((w) => w.toLowerCase() === targetTitle)) {
1189 refs.push(meta)
1190 }
1191 }
1192 return refs
1193}

Callers 2

cmdBacklinksFunction · 0.85
server.tsFile · 0.85

Calls 3

resolveSafeFunction · 0.70
listNotesFunction · 0.70
toPosixFunction · 0.70

Tested by

no test coverage detected