script-utils/demo-vault-coverage
Static coverage/freshness checks that keep a plugin’s in-repo demo-vault/ in sync with its public surface.
A plugin can ship a curated demo vault at demo-vault/ in its repo root. These helpers reflect the real public API/config/docs straight from source and assert — WITHOUT launching Obsidian — that every feature is demonstrated in the notes and that the notes reference no API member that no longer exists (rename drift). The runtime behavior of the plugin is covered by its other integration tests, not by the demo vault; the vault is a learning resource, and these checks only guard that it stays truthful.
Two layers are exposed: - DemoVaultCoverageChecker — a framework-agnostic core that reads the corpus, parses interface / class / enum members and exported functions, and returns diagnostic arrays (what is undemonstrated / stale / unlinked). - registerDemoVaultCoverageSuite — a thin wrapper that registers a vitest suite over the core, so a plugin’s demo-vault.no-app.integration.test.ts is a single declarative call.
Classes
Section titled “Classes”| Class | Description |
|---|---|
| DemoVaultCoverageChecker | Reflects a plugin’s public surface from source and checks its in-repo demo-vault/ stays in sync with it. Every method is a pure query over files under the repo root (the demo corpus is read once and cached), so the checker is trivially unit-testable against a fixture repo and carries no test-framework dependency. |
Interfaces
Section titled “Interfaces”Functions
Section titled “Functions”| Function | Description |
|---|---|
| registerDemoVaultCoverageSuite | Registers a vitest suite that keeps a plugin’s in-repo demo-vault/ in sync with its public surface. Call it once from a plugin’s demo-vault.no-app.integration.test.ts; it registers one test per check, delegating to DemoVaultCoverageChecker. |
| Type | Description |
|---|---|
| DemoVaultInterfaceMemberKind | Whether an interface’s demonstrated members are its methods or its properties. |