@membank/dashboard 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,148 @@
1
1
  # @membank/dashboard
2
2
 
3
- Web UI for membank. Not yet implemented.
3
+ Web UI for browsing, searching, and managing memories. Provides a full-featured dashboard to inspect memory storage, edit metadata, and review memories flagged for deduplication.
4
+
5
+ ## Features
6
+
7
+ - **Browse memories** — list all stored memories with filtering by type, scope, and status
8
+ - **Search** — full-text search across memory content
9
+ - **View details** — inspect individual memories with full metadata
10
+ - **Edit metadata** — change memory type, tags, and pin status
11
+ - **Review flagged** — dedicated view for memories flagged `needs_review` during deduplication
12
+ - **Stats dashboard** — overview of total memory count, distribution by type, and dedup queue size
13
+ - **Dark mode** — theme toggle with system preference detection
14
+
15
+ ## Quick start
16
+
17
+ Start the dashboard from the monorepo root:
18
+
19
+ ```bash
20
+ pnpm dev
21
+ ```
22
+
23
+ Or scoped to just the dashboard:
24
+
25
+ ```bash
26
+ pnpm --filter @membank/dashboard dev
27
+ ```
28
+
29
+ The server starts on `http://localhost:3847` and opens automatically.
30
+
31
+ ## How it works
32
+
33
+ The dashboard runs both a React SPA frontend and a Hono API server:
34
+
35
+ - **Backend** — Express-like API server (`src/server/index.ts`) that connects to the SQLite memory database via `@membank/core`
36
+ - **Frontend** — React + TanStack Router + TanStack DB for client-side state management and async data fetching
37
+ - **Static serving** — built client assets served from the backend with SPA fallback (HTML history API)
38
+
39
+ ## Project structure
40
+
41
+ ```
42
+ src/
43
+ server/
44
+ index.ts # Hono app with /api routes and static file serving
45
+ dev.ts # dev server launcher
46
+ client/
47
+ index.tsx # app entry point
48
+ index.css # Tailwind + global styles
49
+ routes/
50
+ index.tsx # root (redirects to /memories)
51
+ memories.index.tsx # list view
52
+ memories.$id.tsx # detail view
53
+ components/
54
+ MemoryRow.tsx # single memory row with inline edit
55
+ StatsBar.tsx # memory count + dedup queue
56
+ ThemeToggle.tsx
57
+ ui/ # shadcn + base-ui components
58
+ lib/
59
+ api.ts # client-side API client (fetch wrappers)
60
+ types.ts # shared TypeScript types
61
+ utils.ts # classname helpers (clsx/tailwind-merge)
62
+ ```
63
+
64
+ ## API endpoints
65
+
66
+ All requests/responses are JSON.
67
+
68
+ ### `GET /api/memories`
69
+
70
+ List memories with optional filters.
71
+
72
+ Query params:
73
+ - `type` — filter by memory type (e.g., `correction`, `preference`)
74
+ - `scope` — filter by scope (e.g., `global`, project hash)
75
+ - `pinned=true` — show only pinned memories
76
+ - `needsReview=true` — show only flagged memories
77
+ - `search` — full-text search in content
78
+
79
+ Response: array of memory objects with `id`, `content`, `type`, `tags`, `scope`, `sourceHarness`, `accessCount`, `pinned`, `needsReview`, `createdAt`, `updatedAt`.
80
+
81
+ ### `GET /api/memories/:id`
82
+
83
+ Fetch a single memory by ID.
84
+
85
+ ### `PATCH /api/memories/:id`
86
+
87
+ Update a memory's metadata.
88
+
89
+ Body (all optional):
90
+ - `content` — update content (triggers re-embedding)
91
+ - `tags` — array of string tags
92
+ - `type` — change memory type
93
+ - `pinned` — boolean
94
+ - `needsReview` — boolean
95
+
96
+ ### `DELETE /api/memories/:id`
97
+
98
+ Delete a memory (cascades to embeddings).
99
+
100
+ ### `GET /api/stats`
101
+
102
+ Stats snapshot.
103
+
104
+ Response:
105
+ ```json
106
+ {
107
+ "byType": { "correction": 10, "preference": 5, ... },
108
+ "total": 25,
109
+ "needsReview": 2
110
+ }
111
+ ```
112
+
113
+ ## Commands
114
+
115
+ ```bash
116
+ pnpm dev # start dev server (watch mode, auto-reload)
117
+ pnpm build # build SPA + server entry
118
+ pnpm typecheck # tsc --noEmit
119
+ pnpm lint # biome check
120
+ pnpm lint:fix # biome check --write
121
+ pnpm clean # rm dist
122
+ ```
123
+
124
+ ## Tech stack
125
+
126
+ - **Runtime** — Node.js 24+
127
+ - **Server** — Hono 4 + @hono/node-server
128
+ - **Client** — React 19 + TanStack Router + TanStack DB
129
+ - **Styling** — Tailwind CSS 4 + shadcn components
130
+ - **Icons** — @phosphor-icons/react
131
+ - **Build** — Vite 6 (client) + tsdown (server)
132
+ - **Database** — @membank/core (SQLite via better-sqlite3)
133
+
134
+ ## Database connection
135
+
136
+ The dashboard connects to the shared SQLite database at `~/.membank/memory.db` via `DatabaseManager.open()` from `@membank/core`. No special setup required — just ensure the database exists and has the expected schema (created by membank CLI/MCP setup).
137
+
138
+ ## Development notes
139
+
140
+ - **Client-side routing** — TanStack Router with file-based routes in `src/client/routes/`
141
+ - **API calls** — `src/client/lib/api.ts` wraps fetch with error handling and JSON parsing
142
+ - **State management** — TanStack DB (replicated, reactive) + TanStack Query (async cache)
143
+ - **Styles** — Tailwind v4 with custom CSS variables for theme colors; dark mode via `prefers-color-scheme`
144
+ - **UI components** — shadcn + base-ui primitives, no external component library deps
145
+
146
+ ## Port selection
147
+
148
+ Dashboard prefers port `3847` but falls back to an available port if occupied. Port is logged to stdout on startup.