@ai-coach/vault-view-util
Pure, framework-free TypeScript helpers for the vault view. It holds graph force-layout and camera math, markdown/distillation parsers, Obsidian and graph URI builders, plan/climb formatters, theme constants, and keyboard shortcut guards.
What it does not do
- No Angular, RxJS, or DOM side effects. Everything here is pure TypeScript with zero framework dependencies so it can be imported by any
scope:vault-viewlayer and tested directly in Node. - No
data-access,ui, orfeatimports.@nx/enforce-module-boundariesrestrictstype:utiltotype:utilonly. - No network or filesystem I/O. HTTP calls belong in
@ai-coach/vault-view-data-access.
Architecture fit
- Scope:
scope:vault-view - Style:
architecture:layered(type:util) - Depends on: nothing
- Used by:
@ai-coach/vault-view,@ai-coach/vault-view-data-access,@ai-coach/vault-view-ui,@ai-coach/vault-view-feat-graph,@ai-coach/vault-view-feat-plans,@ai-coach/vault-view-feat-climb
[app / data-access / ui / feat-graph / feat-plans / feat-climb]
│
▼
[@ai-coach/vault-view-util]
Internal architecture & rules
- Feature-grouped pure modules: Helpers are grouped by concern under
src/lib/(theme,shortcuts,links,plans,climb,markdown,graph,graph-layout,distill) with colocated*.spec.tsunit tests. - Deterministic math and parsing: Force layout, camera framing, page-ring geometry, and markdown/distillation block parsing are deterministic pure functions taking plain values and returning new data structures.
- Code hygiene: Zero comments in source code (DEC-AIC-0011) and strict TypeScript typing (
tsc --noEmit).
Public surface
- Theme & shortcuts: Theme mode types and defaults, global shortcut target guards (
isGlobalShortcut). - Links & formatting:
obsidianUri,graphNoteHref,sketchImageHref,stripWikilinks,goalDisplayText,pluralize. - Graph & layout: Graph bucket/kind/mastery/workstream/stage tables, node fill helpers,
computeForceLayout,placeBookChaptersAndReaders,computePageRing,viewForBox,zoomAroundPoint,interpolateView, SVG shape paths. - Distillation, markdown, plans & climb:
parseNoteBlocks,parsePageBlocks,splitPageSummary,distillMarkLabel,PLAN_ZOOM_OPTIONS,columnShortLabel,worstGoalStatus,CLIMB_STEPS,CLIMB_STEP_HEADERS,stairBox.
How to extend it
- Add a pure function or constant to the matching module under
src/lib/(or create a new focused module). - Re-export it from
src/index.ts. - Add Vitest unit tests in a sibling
<module>.spec.tsfile covering normal and edge cases. - Run
npm exec nx test @ai-coach/vault-view-util,npm exec nx lint @ai-coach/vault-view-util, andnpm exec nx typecheck @ai-coach/vault-view-util.
Running & testing
Unit tests run directly in Vitest with no DOM, Angular TestBed, or network mocks required.
npm exec nx test @ai-coach/vault-view-util
npm exec nx lint @ai-coach/vault-view-util
npm exec nx typecheck @ai-coach/vault-view-util
Key ADRs
- DEC-AIC-0059 — Establishes the Angular layered frontend layout for the vault view.
- DEC-AIC-0062 — Codifies
utillayer boundaries and Nx lint/typecheck/test guardrails. - DEC-AIC-0051 — Defines workspace tags and
@nx/enforce-module-boundariesconstraints. - DEC-AIC-0060 — Governs the eight-section package README structure and Docusaurus ingestion.