adds schema view and schema generating command

This commit is contained in:
2026-11-03 09:35:41 +01:00
parent cc41decccb
commit 600d4874d2
62 changed files with 4416 additions and 105 deletions
+59 -15
View File
@@ -20,7 +20,7 @@ The three columns of the body, left to right, are:
2. **Editor** (one file and its code)
3. **Agent and Terminal**, a single column split into two stacked panes: the Claude agent pane on top and a shell terminal below it.
Git is not a column: the full-screen **Git view** (section 3) covers all three regions while it is open.
Git is not a column: the full-screen **Git view** (section 3) covers all three regions while it is open. In a Laravel app the full-screen **Schema view** (section 4) does the same; the two never show together.
Every boundary between panes is a draggable splitter. The vertical splitters between the three columns adjust their widths. The horizontal splitter between the agent pane and the terminal pane adjusts their heights. Splitter positions persist across launches. Panes have sensible minimum widths and heights so they cannot be collapsed to nothing by dragging.
@@ -34,8 +34,8 @@ The top bar contains, left to right:
- The Helder wordmark.
- A breadcrumb showing the path to the active file, for example `console / src / Http / Controller / UserController.php`. The breadcrumb is **display only** for now. It is not clickable and does not navigate.
- Centred on the window, the **pane toggles**: Explorer · File · Claude. Each shows or hides one column, all on by default (see Pane toggles in section 9). The breadcrumb truncates before it reaches them.
- On the right, the toolbar: **`Git N`** (`Cmd+G`) toggles the Git view (section 3); N counts the changed files, a file both staged and unstaged once, and the count is left out when there are none. **Search** (`Cmd+F`) is an action; **Fluid** (`Cmd+L`) and **Hidden** (`Cmd+.`) are toggles. Then `?` for the keyboard shortcuts.
- Centred on the window, the **pane toggles**: Explorer · File · Claude. Each shows or hides one column, all on by default (see Pane toggles in section 10). The breadcrumb truncates before it reaches them.
- On the right, the toolbar: **`Git N`** (`Cmd+G`) toggles the Git view (section 3); N counts the changed files, a file both staged and unstaged once, and the count is left out when there are none. In a Laravel app (an `artisan` file in the root) **Schema** (`Cmd+D`) follows it and toggles the Schema view (section 4); elsewhere it is left out. **Search** (`Cmd+F`) is an action; **Fluid** (`Cmd+L`) and **Hidden** (`Cmd+.`) are toggles. Then `?` for the keyboard shortcuts.
- While Helder reads aloud, a **Stop** toggle appears left of **Git**, in the same style and switched on. A click switches it off and stops the reading; the button then goes away. It also goes away when the reading reaches the end, and a project switch or window close stops the reading.
---
@@ -98,7 +98,51 @@ The bottom-right panel: **local** branches, then **remote · origin**. The curre
---
## 4. Explorer panel
## 4. Schema view
A full-screen view, drawn like the Git view, that shows the database of a Laravel app as a diagram of tables and foreign-key lines. It exists only in a Laravel app: a project with an `artisan` file in its root. Elsewhere there is no **Schema** button, `Cmd+D` does nothing and View › Show Schema is disabled. `Cmd+D`, the **Schema** toggle and View › Show Schema open it; `Cmd+D`, `Esc` and its **Close** button close it. Opening it closes the Git view, and opening the Git view closes it. Dialogs, menus, search and toasts sit above it, and the columns stay mounted under it. It is not persisted: a project always opens with it closed.
Helder reads the diagram from `database/helder/schema.json`, which the app's own Artisan command `app/Console/Commands/HelderSchemaCommand.php` (`php artisan helder:schema`) writes. The file's contract is in [schema.md](schema.md).
While it is open, the columns' row, focus and editor keys rest, as over the Git view; `Cmd+Return` and `Cmd+C` do nothing. `Esc` closes the topmost layer: an overlay first, then the table selection, then the table search's text (only while the search has the keyboard), then the view.
### States
- **No command yet**: the app has no `HelderSchemaCommand.php`. The body shows `[ NO COMMAND YET ]`, a line that names the dump and the command, **Generate command** and **Copy prompt**, and a scrollable, selectable preview of the prompt. **Generate command** closes the view and pastes the prompt into the Claude prompt without sending it (toast `Passed to agent` · `Command prompt`). **Copy prompt** copies it (toast `Copied prompt`). The top bar reads `no command yet`, its Run button is disabled and the command path is hidden.
- **No dump yet**: the command exists, the dump does not. `[ NO DUMP YET ]`, a line about `database/helder/schema.json`, the Run button and `$ php artisan helder:schema`.
- **Diagram**: the table list, the canvas, and the detail panel while a table is selected.
The view flips between these states by itself: the watcher re-checks the command and re-reads the dump when its modification date changes, so a command that Claude writes and runs in the terminal shows its diagram without a click. A re-read keeps the pan, the zoom and the card positions; new tables get a default place.
### Top bar
`[ schema ]`, then (with a dump) the database icon and `driver · database` in amber, then `no command yet`, `no dump yet` or `dumped 14:32 · 16 tables · 23 relations`. On the right: the command path as a text button (it closes the view and opens the command in the editor), the amber Run button (`Run helder:schema`, `Re-run helder:schema` once a dump exists, `Dumping…` while it runs; clicks are ignored then) and **Close** (`⌘D`).
### Running the command
Run executes `php artisan helder:schema` in the project root with Herd's php, else the `php` on `PATH`. The console opens and shows `$ php artisan helder:schema`, then each output line as it arrives: errors in amber, `INFO`/`DONE`/`Wrote …` lines in teal. Exit code 0 re-reads the dump and toasts `Schema dumped · N tables`; any other code keeps the console open and toasts nothing more. A run stops after 120 seconds. A dump that is not valid JSON shows its error in the console and toasts `Could not read the schema`.
### Table list
240pt, left. A search field (`Find a table`) filters by substring; `Return` selects and centres the first match. `[ TABLES ] 16`, or `[ TABLES ] 3 of 16` while filtering. One row per table in name order with its row count. Hovering a row lights the table on the canvas as hovering the card does; a click selects and centres it.
### Canvas
Cards (240pt wide; a 33pt header with the name and row count, then a 22pt row per column with `PK`/`FK`/`UQ`, the name and the type, `?` for nullable) and one cubic line per foreign key, from the key's row to the referenced row: hollow end at the key, filled end at the target. Drag the background or scroll to pan; `Cmd`/`Ctrl` + scroll and pinch zoom around the pointer, 30–200%. The control bottom right zooms out, shows the percentage, zooms in (×1.2) and fits all cards (48pt margin, at most 110%). The first dump fits itself. Drag a card to move it (a press that moves less than 4pt is a click); its position is saved per project in Helder's settings when the drag ends.
Hovering a table lights every line in or out of it in amber, outlines related tables and dims the rest to 30%; hovering a foreign-key row narrows that to one relationship. A click selects a table (click it again or the empty canvas to deselect). Without a focus, the search outlines matching cards and dims the rest. Only colour and opacity change, over 160ms; nothing moves.
### Detail panel
320pt, right, while a table is selected: the name, the row count and a close button; `[ COLUMNS ] N` with each column's type and flags (`PRIMARY · NOT NULL`, `FK → users.id · NULL`, `UNIQUE · NOT NULL`); `[ BELONGS TO ]` (outgoing keys) and `[ HAS MANY ]` (incoming keys), whose rows light the other table on hover and select and centre it on click; or `— No foreign keys in or out.`. Footer: **Pass on to Claude** closes the view and inserts `@schema:<table>` into the Claude prompt; **Copy name** copies it (toast `Copied table name`).
### Console
150pt, at the bottom, from the first run: `[ CONSOLE ] ARTISAN` and the run output, kept at the newest line, at most 400 lines. The chevron hides it until the next run.
---
## 5. Explorer panel
The second column. A standard project file tree.
@@ -112,7 +156,7 @@ The second column. A standard project file tree.
---
## 5. Editor
## 6. Editor
The third and widest column. It shows exactly one file: a bar on top and the code below. Opening another file replaces it. Opening a file always reads it fresh from disk. Edits are written only with `Cmd+S` (or by `editor.autoSave`). Opening a file, the same one included, while the open file has unsaved edits asks **Save**, **Don't Save** or **Cancel**: Save writes and then opens, Don't Save drops the edits and opens, Cancel keeps the current file, its edits and the Explorer selection. A failed save keeps the file open. With `editor.autoSave` on, the file saves silently instead of asking.
@@ -144,7 +188,7 @@ Shared rules: teal is what the file holds now, amber-deep is what it held before
### Editing behavior
- A file with no changes opens directly in a normal editable view with no Diff button, since there is nothing to diff.
- Editing follows the editor settings: indentation, indent width, trim trailing whitespace, insert final newline, word wrap, indent guides, whitespace rendering, and active-line highlight, all read from configuration (section 10).
- Editing follows the editor settings: indentation, indent width, trim trailing whitespace, insert final newline, word wrap, indent guides, whitespace rendering, and active-line highlight, all read from configuration (section 11).
- **Word wrap** follows `editor.wordWrap`: `markdown` (default), `on`, or `off`. When it is on, a line too wide for the pane folds onto the next row instead of scrolling sideways. Only the first row of a folded line carries a line number; the rows below it stay blank. Diff never wraps, because its two panes align row by row.
### Right-click in code
@@ -168,7 +212,7 @@ On a marked line of the live file (any marked line, blank lines and the space af
---
## 6. Agent pane
## 7. Agent pane
The top pane of the fourth column.
@@ -190,7 +234,7 @@ The agent hands the user text to copy through one file, `.clean-copy` in the pro
---
## 7. Terminal pane
## 8. Terminal pane
The bottom pane of the fourth column.
@@ -211,7 +255,7 @@ Right-clicking in the agent pane or the terminal pane shows a menu without a hea
---
## 8. Status bar
## 9. Status bar
A bar across the bottom of the window. All items are **display only** for now; none are clickable.
@@ -220,7 +264,7 @@ A bar across the bottom of the window. All items are **display only** for now; n
---
## 9. Global interactions
## 10. Global interactions
### Go to File (`Cmd+P`)
@@ -246,11 +290,11 @@ Inside the overlay:
The pointer shows what a left click does at that spot. It depends only on what lies under the mouse.
- **Pointing hand** only where a left click runs an action: buttons (title-bar toggles and tools, `?`, Preview, Diff, the Git view's buttons and section headers, dialog buttons, Collapse, search chips), clickable rows (Git view file rows and switchable branches, Explorer rows, search results, recent files and projects, launcher rows, symbol popup rows, context-menu items) and the project name in the title bar. Never on a view that only reacts to a right-click, a tooltip or hover.
- **Pointing hand** only where a left click runs an action: buttons (title-bar toggles and tools, `?`, Preview, Diff, the Git view's buttons and section headers, dialog buttons, Collapse, search chips), clickable rows (Git view file rows and switchable branches, Schema table rows, cards and relation rows, Explorer rows, search results, recent files and projects, launcher rows, symbol popup rows, context-menu items) and the project name in the title bar. Never on a view that only reacts to a right-click, a tooltip or hover.
- **I-beam** where a click places a caret or starts a selection: the code (also below the last line), the Markdown preview, both terminals, the commit message, the Git console and every overlay input.
- **Arrow** everywhere else: labels, headers, folder labels, the gutter, the status bar, scrims, toasts, empty states, and a disabled button such as Commit with nothing staged.
- With an overlay open, every column behind it, and the Git view, shows the arrow; the overlay's own buttons, rows and inputs keep theirs.
- A splitter shows a resize arrow; `Cmd` over a known PHP class name in the code shows the hand. No other pointers are used.
- A splitter shows a resize arrow; `Cmd` over a known PHP class name in the code shows the hand. No other pointers are used: the Schema canvas pans with the arrow, without a grab hand.
### Pane resizing
@@ -266,7 +310,7 @@ When `session.restoreOnLaunch` is on (default), reopening a project restores the
---
## 10. Configuration
## 11. Configuration
Settings are project-scoped and live in a `.helder` folder in the project root.
@@ -279,12 +323,12 @@ Settings that affect behavior described above include indentation and editor dis
---
## 11. States and edge cases summary
## 12. States and edge cases summary
- **No project open**: the window shows an empty state inviting the user to open a project folder.
- **Clean working tree**: the Git view shows its clean message; the Explorer still shows the full tree.
- **Unchanged file open**: normal editable view, no Diff button.
- **Added or deleted file**: views behave as described in section 5.
- **Added or deleted file**: views behave as described in section 6.
- **Binary or unsupported file**: placeholder, no Preview or Diff button.
- **Search with no matches**: per-column no-results messages.
- **Agent command not available**: the agent pane is a terminal, so a missing or failing command surfaces as ordinary terminal output in that pane.