Skip to content

feat(databases): CSV-backed databases — Table + Board, record pages, vim grid#81

Merged
adibhanna merged 2 commits into
mainfrom
feat/csv-databases
Jun 9, 2026
Merged

feat(databases): CSV-backed databases — Table + Board, record pages, vim grid#81
adibhanna merged 2 commits into
mainfrom
feat/csv-databases

Conversation

@adibhanna

Copy link
Copy Markdown
Contributor

A .csv in the vault becomes a full database (à la Notion / Obsidian Bases): typed fields, multiple views, and per-record pages — zero new dependencies (hand-rolled RFC-4180).

Highlights

  • Table + Board views over a .csv + co-located .csv.base.json sidecar (schema/views/pages). Rows get a stable id UUID column so external edits round-trip.
  • Editable grid: inline cell editing, typed fields (text/number/checkbox/date/select/multiSelect), add/rename/retype/delete fields, sort, filter, raw-CSV toggle, row-selection checkboxes with bulk delete.
  • Records as pages: each row links to a real markdown note in a per-db folder; properties mirror into frontmatter, the body is the freeform page. The title cell shows a page icon reflecting whether the note has content, plus a hover Open button; opening focuses the editor.
  • Vim grid: the Table view is a focusable grid — h/j/k/l, gg/G, 0/$, i/Enter to edit, Space/x to select, o to open, a to add, dd to delete. VimNav yields to it via data-zen-db-grid.
  • Create from the sidebar: right-click a folder → New database (location-aware).
  • Right-click a row → Open / Delete. Frontmatter rendered compact + muted in the editor.

Verification

npm run typecheck (7/7), npm run test:run (140 passed / 1 skipped), npm run build (6/6) — all green locally.

adibhanna added 2 commits June 9, 2026 17:46
Add a general "databases" primitive: a .csv file in the vault is a database
(rows = records, typed columns = fields) shown through multiple views — an
editable spreadsheet Table and a Board grouped by a select field. Separate
from, and leaving untouched, the markdown-task kanban.

Backend (shared-domain + main):
- databases.ts types + virtual tab-path helpers; hand-rolled RFC-4180
  database-csv.ts (parse/serialize, schema inference); type-aware
  database-transforms.ts (filter/sort/group). Zero new dependencies.
- main/databases.ts: read/write/create/list over a .csv + co-located
  .csv.base.json sidecar (types + views); extracted writeFileAtomic;
  adopt-a-plain-CSV by inferring schema + materializing stable row ids.
- IPC channels + 'database' watch scope; ZenBridge/preload; watcher
  detection for .csv/.csv.base.json; web-bridge stubs (desktop-only for now).

Renderer (app-core):
- a database tab is a virtual tab (never hits the markdown pipeline); routed
  in EditorPane.
- store slice: load/open/create + optimistic edits with debounced persistence
  and watcher-echo reconciliation.
- DatabaseView host + DatabaseTableView (inline per-type cell editing, field
  menu rename/retype/sort/delete, add row/field) + DatabaseBoardView (group by
  a select field, HTML5 drag-to-move, add column). "New Database" command;
  Table/Database icons.

Tests: 20 new (CSV round-trip incl. commas/quotes/multiSelect, inference,
transforms, IO round-trip/adopt/create). typecheck 7/7, all tests green,
desktop + web build clean.

Note: the UI has not been runtime-verified yet; the Board uses native HTML5
drag-and-drop (lighter than the TasksKanban pointer engine). Sidebar .csv
surfacing is a follow-up.
Builds on the CSV-backed databases (bc7682f) with the follow-ups from
live testing:

- Records as pages: each row links to a real markdown note in a per-db
  folder; row properties mirror into the note's frontmatter, the body is
  the freeform page. The title cell shows a page icon that reflects
  whether the note has content, plus a hover "Open" button; opening a
  page moves the cursor into its editor.
- Vim grid: the Table view is a focusable grid with h/j/k/l, gg/G, 0/$,
  i/Enter to edit, Space/x to select, o to open, a to add, dd to delete.
  VimNav yields to it via data-zen-db-grid so motions aren't stolen by
  sidebar/note-list navigation.
- Sidebar: right-click a folder to create a database in that location.
- Views: rename/delete views; raw-CSV toggle; row-selection checkboxes
  with bulk delete; right-click a row to Open or Delete it.
- Frontmatter rendered compact and muted in the editor (cm-frontmatter).
- Drop .bak clutter; route asset-csv tabs to the database view; portal
  the select dropdown so it isn't clipped by the table's overflow.
@adibhanna
adibhanna merged commit 75dd28e into main Jun 9, 2026
5 checks passed
@adibhanna
adibhanna deleted the feat/csv-databases branch June 9, 2026 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant