Vault scanner and note model
State: open/verified · Kind: module · Audience: system
Summary
Section titled “Summary”- Walks an Obsidian-style vault of markdown files and returns a typed note model — per-file metadata, frontmatter, tags, outgoing links/embeds resolved to vault-relative paths, and computed backlinks — with no Obsidian app involved.
- Ships as
@sksizer/obsidian-vault; the model types are plain interfaces so any provider producing the same shape can stand in for the disk scanner.
Statement
Section titled “Statement”A vault is a folder of markdown files linked by Obsidian conventions: wikilinks, embeds, tags, YAML
frontmatter. scanVault walks a directory (symlink-safe, skips .obsidian/.git/node_modules)
and produces an in-memory VaultIndex: parsed frontmatter, normalized tags (frontmatter + inline),
outgoing links/embeds resolved with Obsidian’s own shortest-path-first rules, and backlinks. A
parallel createVaultIndex path builds the identical model from externally supplied note data,
sharing the same normalization and resolution code, so fixture- or index-backed callers never touch
the filesystem. It is read-only and model-only: no query language, no rendering, no writes, and no
structural transforms (rename/move/reshape).
What it provides
Section titled “What it provides”- scanVault(root) — recursive vault walk producing a VaultIndex of VaultNote records (file meta, properties, tags, links, embeds, backlinks).
- createVaultIndex — the same model built from caller-supplied note data, for browser or fixture-driven callers with no filesystem.
- Standalone parseFrontmatter/extractLinks/extractInlineTags helpers, and Obsidian-compatible link resolution with backlink computation.
Underlying implementation
Section titled “Underlying implementation”- packages/ts/obsidian-vault/src/scan.ts#scanVault
- packages/ts/obsidian-vault/src/from-data.ts#createVaultIndex
Locations
Section titled “Locations”packages/ts/obsidian-vault/