mirror of
https://github.com/aaronsb/obsidian-mcp-plugin.git
synced 2026-07-22 06:45:14 +00:00
Before: graph.statistics threw 'Source path is required' when called
without sourcePath, blocking the baseline use case (vault health
snapshots, dashboards). Users had to pick an arbitrary seed and reason
about its neighborhood — not representative.
After: when sourcePath is omitted, return a new vaultStatistics shape:
totalNotes — count of .md files in the vault
totalLinks — sum of resolved link occurrences (Obsidian
semantics: A→B referenced 3× counts as 3)
orphanCount — singletons (no links in either direction)
averageDegree — 2 * totalLinks / totalNotes
largestComponentSize — biggest connected subgraph (undirected)
isolatedClusters — total connected-component count,
inclusive of singletons (so non-trivial =
isolatedClusters - orphanCount)
Per-node statistics behaviour is unchanged when sourcePath is provided.
Implementation: GraphTraversal.getVaultStatistics does one O(V+E)
pass over the resolvedLinks adjacency, plus BFS for components.
Treats the graph as undirected for component analysis (a link from A
to B means A and B are in the same component) while keeping link
counts directed (matches how metadataCache exposes them).
Tests: tests/graph-statistics-vault-wide.test.ts covers the
vault-wide path (the topology described above), per-node fallback,
empty vault, repeated occurrences, non-md filtering, and the
directed-edges-undirected-components invariant.
|
||
|---|---|---|
| .. | ||
| __mocks__ | ||
| fixtures | ||
| security | ||
| validation | ||
| bases-expression-evaluator.test.ts | ||
| bases-yaml.test.ts | ||
| combine-inline-router.test.ts | ||
| combine-inline.test.ts | ||
| dataview-integration.test.ts | ||
| dispatch-param-guards.test.ts | ||
| file-lock-edit-serialization.test.ts | ||
| fuzzy-match.test.ts | ||
| graph-node-title.test.ts | ||
| graph-search-traversal.test.ts | ||
| graph-search.test.ts | ||
| graph-statistics-vault-wide.test.ts | ||
| list-files-recursive.test.ts | ||
| mcp-server.test.ts | ||
| mcp-session-reinit.test.ts | ||
| network-classifier.test.ts | ||
| network-exposure-integration.test.ts | ||
| patch-operations.test.ts | ||
| read-only-mode.test.ts | ||
| recursive-copy.test.ts | ||
| search-tag-operator.test.ts | ||
| setup.ts | ||
| vault-read-fidelity.test.ts | ||