feat(databases): CSV-backed databases — Table + Board, record pages, vim grid#81
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A
.csvin 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
.csv+ co-located.csv.base.jsonsidecar (schema/views/pages). Rows get a stableidUUID column so external edits round-trip.h/j/k/l,gg/G,0/$,i/Enterto edit,Space/xto select,oto open,ato add,ddto delete.VimNavyields to it viadata-zen-db-grid.Verification
npm run typecheck(7/7),npm run test:run(140 passed / 1 skipped),npm run build(6/6) — all green locally.