adds schema design

This commit is contained in:
2026-11-02 17:40:16 +01:00
parent 6e58684495
commit cc41decccb
12 changed files with 2836 additions and 8 deletions
+128 -5
View File
@@ -1,4 +1,4 @@
# Handoff: Helder App v2 — full-screen Git view
# Handoff: Helder App v2 — full-screen Git view and Schema view
## Overview
Helder is a desktop IDE shell for one developer working with Claude Code. It has a title bar, an Explorer (file tree), a File editor, a Claude transcript with prompt and terminal, a status bar, plus overlays for search and file diff.
@@ -13,7 +13,9 @@ Helder is a desktop IDE shell for one developer working with Claude Code. It has
- read the real git commands and their output in a **console**, and type git commands there
- see local and remote **branches** and switch between them, but only when the working tree is clean
Everything outside the Git view works as it did in v1 (Explorer, File, Claude, terminal, search, diff, menus, modals). The only exceptions are the changed shortcuts listed below.
**v2 also adds a full-screen Schema view** (⌘D). It exists only when the open Laravel app contains `app/Console/Commands/HelderSchemaCommand.php`. It runs `php artisan helder:schema`, reads the dump it writes, and draws the whole database as a navigable diagram of tables and foreign-key lines. See *Screen: Schema view* below.
Everything outside the Git and Schema views works as it did in v1 (Explorer, File, Claude, terminal, search, diff, menus, modals). The only exceptions are the changed shortcuts listed below.
## About the design files
The files in this bundle are **design references created in HTML**. They are prototypes that show the intended look and behaviour; they are not production code to copy. The task is to **recreate this design in Helder's real codebase**, using its existing framework, state management and git layer. If no environment exists yet, pick the best fit; for a desktop IDE shell that is likely Electron or Tauri, with React and a real git backend such as `simple-git`, `isomorphic-git` or shelling out to `git`.
@@ -29,6 +31,7 @@ The prototype fakes git: file contents live in memory, and console output is sim
| Key | Action |
|---|---|
| ⌘G / Ctrl+G | Open or close the Git view |
| ⌘D / Ctrl+D | Open or close the Schema view (only when the app has `HelderSchemaCommand.php`) |
| ⌘1 / ⌘2 / ⌘3 | Toggle Explorer / File / Claude (in v1 this was ⌘1–4, with Git on ⌘1) |
| ⌘F | Search the project |
| ⌘L | Fluid (soft wrap) |
@@ -36,9 +39,10 @@ The prototype fakes git: file contents live in memory, and console output is sim
| ⌘N | Scratch note |
| ⌘↵ (in the commit message) | Commit |
| ↑ (in the console input) | Recall the last command |
| Esc | Closes the topmost layer, in this order: context menu → modal → search → file diff → Git view → interrupts Claude |
| Enter (in the Schema table search) | Centre the first matching table |
| Esc | Closes the topmost layer, in this order: context menu → modal → search → file diff → Schema selection → Schema view → Git view → interrupts Claude |
The title-bar panel toggle group now reads `Git N · Explorer · File · Claude`. **N** is the number of changed files, and the Git button's dot is amber while the view is open.
The title-bar panel toggle group now reads `Git N · Schema · Explorer · File · Claude`. **N** is the number of changed files. The Git and Schema buttons show an amber dot while their view is open. The Schema button is left out when the command file does not exist. Git and Schema are mutually exclusive: opening one closes the other.
---
@@ -205,6 +209,104 @@ If there are no changes at all, the area shows only: `— No changes. The workin
---
## Screen: Schema view (full screen)
### When it exists
- Detect `app/Console/Commands/HelderSchemaCommand.php` in the open project; watch for it, so the view appears as soon as the file is created.
- No file → no title-bar button, ⌘D does nothing.
- The command (included in the prototype's fake repo, see the file) uses Laravel's `Schema::getTables / getColumns / getIndexes / getForeignKeys`. It skips `migrations`, `jobs`, `cache` and `sessions`, and writes `storage/helder/schema.json`:
```
{ connection, generated_at, tables: [{ name, columns[], indexes[], foreign_keys[] }] }
```
- Helder reads that JSON. Row counts are not in the dump yet; the prototype shows fake ones. Either add `rows` per table to the command (`DB::table($name)->count()`, or `information_schema.TABLES.TABLE_ROWS` for speed), or drop the row-count labels.
### Layer
`position: fixed; inset: 0`, `z-index: 45`, background `#101720`, min-width 900px, flex column. From top to bottom: top bar, body (table list · canvas · detail panel), console.
### 1. Top bar — 44px
Same frame as the Git top bar (background `#18202B`, bottom border `1px #232C39`, padding `0 14px`, gap 14px).
- `[ SCHEMA ]`: Plex Mono 700 11px, .14em, uppercase, `#828D9A`.
- Connection: Lucide `database` 13px + `mysql · odynt`, Plex Mono 500 12px `#E8913A`. Real build: driver and database name from the dump.
- Meta: Plex Mono 12px `#828D9A`, ellipsis. Before a dump: `no dump yet`. After: `dumped 14:32 · 16 tables · 23 relations` (time of the last successful run).
- Spacer.
- Command path `app/Console/Commands/HelderSchemaCommand.php` as a text button, Plex Mono 12px `#828D9A`, hover `#F4F5F4`. Click: close the view and open the file in the editor.
- **Run button**, 28px, padding `0 12px`, radius 2px, background `#E8913A`, text `#101720`, Plex Sans 600 12px, icon `terminal` 14px. Hover `#C4741F`. Label: `Run helder:schema`, `Re-run helder:schema` once a dump exists, `Dumping…` while running (clicks ignored).
- **Close**: the same style as the Git Close button, key hint `⌘D`.
### 2. Empty state (no dump yet)
Centred in the canvas, max-width 440px, gap 16px:
- `[ NO DUMP YET ]`: Plex Mono 700 11px, .14em, `#E8913A`.
- `— Helder draws the schema from storage/helder/schema.json. Run the command to write it.` Plex Sans 15px / 1.6 `#BAC0C0`; the path in Plex Mono `#F4F5F4`.
- Primary button (36px, padding `0 16px`, Plex Sans 600 13px, amber) with the run label, and next to it `$ php artisan helder:schema` in Plex Mono 12px `#6C7783`.
- If `storage/helder/schema.json` already exists when the view opens, load it straight away and skip the empty state.
### 3. Table list (left) — 240px
Background `#18202B`, right border `1px #232C39`. Shown only once a dump exists.
- Search row, 44px, bottom border: `search` icon 14px `#828D9A`, input `Find a table`, Plex Mono 13px `#F4F5F4`, no border. Filters by substring. Enter centres the first match; Esc clears the query.
- Label row, 34px: `[ TABLES ] 16`, or `[ TABLES ] 3 of 16` while filtering. Plex Mono 700 10px, .14em, `#6C7783`.
- Rows, alphabetical, 30px, padding `0 14px 0 11px`, 3px left border, grid `1fr auto`:
- Name: Plex Mono 12px, `#BAC0C0` (`#F4F5F4` when hovered or selected).
- Row count: Plex Mono 11px `#6C7783`, `en-US` thousands separators.
- Selected: left border `#E8913A`, background `rgba(232,145,58,.10)`. Hover: background `#1F2834`.
- Hovering a list row highlights that table on the canvas exactly like hovering the table itself. Click: select and centre it.
### 4. Canvas (centre, flex 1)
Background `#101720`, `overflow: hidden`. One transformed layer (`translate(x,y) scale(k)`, origin `0 0`) holds an SVG of relationship lines, with the table cards on top.
**Navigation**
- Drag the background: pan (cursor `grab` / `grabbing`).
- Scroll / trackpad: pan. ⌘ or Ctrl + scroll, and pinch: zoom around the cursor. Zoom range 30–200%.
- Bottom-right control (background `#18202B`, border `1px #232C39`, radius 2px, 28px tall): `−` · zoom % (52px, Plex Mono 500 11px `#828D9A`) · `+` (steps of ×1.2, around the centre) · `Fit`. Fit frames all tables with 48px margin, max 110%.
- Bottom-left hint, Plex Mono 11px `#6C7783`: `drag to pan · ⌘ scroll to zoom · hover a table or a key to trace it · click to inspect`.
- The first dump auto-fits. Later re-runs keep the user's view and positions.
**Table card** — 240px wide, background `#18202B`, `1px` border, radius 4px, `user-select: none`.
- Header, 33px including its `1px #232C39` bottom border, padding `0 10px`: name in Plex Mono 700 12px `#E4E7E6`, row count right-aligned in Plex Mono 11px `#6C7783`.
- Column rows, 22px, padding `0 10px`, grid `20px 1fr auto`, gap 6px:
- Key: Plex Mono 700 9px, .06em — `PK` in `#F0B476`, `FK` / `UQ` in `#828D9A`, blank otherwise.
- Name: Plex Mono 12px; `#E4E7E6` for keys, `#BAC0C0` for the rest.
- Type: Plex Mono 11px `#6C7783`, with `?` appended for nullable columns (`timestamp?`).
- Geometry matters for the lines: the centre of column *i* sits at `top + 45 + i × 22`.
- Cards can be dragged to new positions (4px threshold separates a drag from a click). Real build: persist positions per project, e.g. `storage/helder/schema-layout.json` or app settings, so a re-run does not reshuffle.
**Default layout**: five lanes, 340px apart, tables stacked with 48px gaps, each lane vertically centred against the tallest. The prototype hard-codes the lane per table. Real build: rank tables by foreign-key depth (tables nothing points from on the left… or start with a simple layered/Sugiyama layout such as `dagre` or `elkjs` in LR direction), then let the user rearrange.
**Relationship lines** — one per foreign key, drawn from the FK column row to the target table's primary-key row.
- Cubic Bézier with horizontal tangents. Target to the right: leave from the right edge, enter the left edge. Target to the left: the mirror. Same lane (centres closer than 240px): leave and enter on the right edge, looping out by `46 + |Δy| × 0.12` px.
- Ends: hollow circle r3 at the FK end (fill `#101720`), filled circle r3 at the PK end.
- Resting: `#3A424C`, 1.25px.
**Hover and selection — the core of the view**
- *Focus* = the hovered table, otherwise the selected table.
- **Hover a table**: every line in or out of it turns `#E8913A`, 1.75px, drawn on top. Its card border turns `#E8913A` with header background `rgba(232,145,58,.10)`. Related tables keep full opacity with border `#6C7783`; all other tables drop to 30% opacity; inactive lines go to `#232C39`. The FK columns involved and the target PK rows get an amber key, `#F4F5F4` name and `rgba(232,145,58,.10)` row fill.
- **Hover an FK column**: narrows the highlight to that one relationship and its two tables.
- **Click a table**: selects it (border `#C4741F` while another table is hovered), opens the detail panel. Click it again or click empty canvas to deselect. Esc deselects first, then closes the view.
- **Search** with no focus: matching cards get border `#F0B476`, the rest drop to 30%.
- Opacity and border colour transition 160ms `cubic-bezier(0.22,1,0.36,1)`. Nothing moves.
### 5. Detail panel (right) — 320px, only with a selection
Background `#18202B`, left border `1px #232C39`.
- Header, 44px: table name (Plex Mono 700 13px `#F4F5F4`), `214,330 rows` (11px `#828D9A`), close `x`.
- `[ COLUMNS ] N`, then one block per column (padding `7px 16px`, top border `#232C39`): name (Plex Mono 500 12px `#E4E7E6`), type right-aligned (11px `#828D9A`), and a flags line (11px): `PRIMARY · NOT NULL`, `FK → users.id · NULL`, `UNIQUE · NOT NULL`. Key flags in `#F0B476`, otherwise `#6C7783`.
- `[ BELONGS TO ]`: outgoing FKs — `→ users … via user_id`. `[ HAS MANY ]`: incoming FKs — `← messages … via conversation_id`. Rows: Plex Mono 12px, arrow `#E8913A`, table `#F4F5F4`, `via …` `#828D9A`, hover `#1F2834`. Hover highlights that table on the canvas; click selects and centres it. This is how you walk the schema.
- No FKs either way: `— No foreign keys in or out.`
- Footer, two equal 30px outline buttons: **Pass on to Claude** (closes the view, inserts `@schema:<table>` into the prompt) and **Copy name** (toast `Copied table name`).
### 6. Console — 150px, after the first run
Same styling as the Git console. Header `[ CONSOLE ] ARTISAN`, a `chevron-down` button hides it until the next run. Stays scrolled to the bottom. The prototype prints:
```
$ php artisan helder:schema
Connection ............................ mysql · odynt
Tables ................................ 16
Columns ............................... 104
Foreign keys .......................... 23
Wrote storage/helder/schema.json (18.4 KB) (#8FBFB4)
DONE Schema dumped in 0.41s. (#8FBFB4)
```
Real build: run `php artisan helder:schema` in the project root (respect the project's PHP binary / Sail / Herd setup), stream real stdout and stderr, show errors in `#E8913A`, and reload the JSON on exit code 0. Toast on success: `Schema dumped · 16 tables`.
---
## Interactions & behaviour
**Stage / unstage**
@@ -271,6 +373,22 @@ gInput: string; gHist: string[] // console input + history
- `unstaged` = changed minus staged. Sections come from status plus staged membership.
- `dirty` = changed.length > 0; it locks branch switching.
## State (Schema view)
```
schemaOpen: boolean // ⌘D
schema: null | { tables: [{ name, rows, cols: [{ n, t, pk, fk, uq, nul }] }],
edges: [{ from, col, ci, to }] } // parsed from schema.json
sPos: { [table]: { x, y } } // card positions, persist per project
sView: { x, y, k } // pan + zoom
sHover: string | null // hovered table
sCol: string | null // hovered FK, `${table}.${column}`
sSel: string | null // selected table → detail panel
sQ: string // table search
sBusy: boolean; sDumped: string | null // run state, last dump time
slog: { t, c }[]; slogOpen: boolean // artisan console
```
**Derived**: active edges = edges touching the focus (or only the hovered FK); related tables = both ends of every active edge.
## Design tokens used
- **Slate surfaces**:
- `#101720`: page, editor, diff, message field
@@ -303,11 +421,12 @@ gInput: string; gHist: string[] // console input + history
- `arrow-down-to-line`, `arrow-up-from-line`
- `minimize-2`, `chevron-down`, `chevron-right`
- `eraser`, `check`, `file-text`, `sparkle`, `files`
- Schema: `database`, `terminal`, `search`, `minus`, `plus`, `x`
- **Fonts**: IBM Plex Mono and IBM Plex Sans (Google Fonts, through the Kade `tokens/fonts.css`).
- There are no images.
## Files
- `Helder App v2.dc.html`: the full prototype. Open it in a browser next to `support.js`; it loads the Kade tokens and bundle from `_ds/blijnder-e2fd6583-1c87-4e16-bc91-117f035adbbc/` in the source project.
- `Helder App v2.dc.html`: the full prototype. Open it in a browser from this folder; it loads `support.js` and the Kade tokens and bundle from the included `_ds/blijnder-e2fd6583-1c87-4e16-bc91-117f035adbbc/`. Serve the folder over http (e.g. `npx serve`) rather than opening it as `file://`.
- **Where to look in the file**:
| What | Where |
@@ -315,5 +434,9 @@ gInput: string; gHist: string[] // console input + history
| Git view markup | the `<!-- git overlay -->` block |
| Git logic | methods prefixed `g…`: `gStage`, `gUnstage`, `gDiscard`, `gCommit`, `gPush`, `gPull`, `gSwitch`, `gStatus`, `gRun`, `gitRows` |
| Section, row and branch view models | `renderVals()`, from `const GC` to `brGroups` |
| Schema view markup | the `<!-- schema overlay -->` block |
| Schema logic | the `// ---------- schema` section: `schemaData` (fake dump + default layout), `sPath` (line geometry), `sFit`, `sZoom`, `sCenter`, `sDown`/`sMove`/`sUp` (pan + drag), `schemaRun`, `schemaVals` (highlight rules and view models) |
| Fake command file | `put('app/Console/Commands/HelderSchemaCommand.php', …)` in the seed data |
- `support.js`: the prototype runtime, needed only to open the HTML. Do not port it.
- `_ds/…`: the Kade tokens and component bundle, needed only to render the prototype. Use the codebase's own copy of the design system.