adds schema view and schema generating command
This commit is contained in:
+3
-2
@@ -23,7 +23,7 @@ This guide explains Helder from the user's side: what each part of the window sh
|
||||
```
|
||||
|
||||
1. [Title bar](title-bar.md): breadcrumb, pane toggles and toolbar.
|
||||
2. [Git](git.md): the full-screen Git view (`Cmd+G`), with the [commit form](git-commit-form.md), a console and the branches.
|
||||
2. [Git](git.md): the full-screen Git view (`Cmd+G`), with the [commit form](git-commit-form.md), a console and the branches. In a Laravel app, [Schema](schema.md) (`Cmd+D`) draws the database the same way.
|
||||
3. [Explorer](explorer.md): the project's file tree.
|
||||
4. [File view](file-view.md): one open file, with [Markdown preview](file-view-markdown.md) and [Diff](file-view-diff.md).
|
||||
5. [Claude Code](claude-code.md): the agent session.
|
||||
@@ -41,10 +41,11 @@ This guide explains Helder from the user's side: what each part of the window sh
|
||||
- [Recent projects](recent-projects.md): switch to or open another project.
|
||||
- [Notifications](notifications.md): the short messages that confirm or warn.
|
||||
|
||||
### Git and files
|
||||
### Git, schema and files
|
||||
|
||||
- [Git](git.md): the full-screen Git view: changes, inline diffs, pull, push, console and branches.
|
||||
- [Git commit form](git-commit-form.md): write a message, commit, or commit and push.
|
||||
- [Schema](schema.md): the full-screen database diagram of a Laravel app (`Cmd+D`).
|
||||
- [Explorer](explorer.md): browse, create, rename and delete files.
|
||||
|
||||
### The file view
|
||||
|
||||
@@ -20,6 +20,8 @@ Helder is built to run from the keyboard. Press `?` to see a short list of the m
|
||||
| | ... | |
|
||||
| | GIT | |
|
||||
| | ... | |
|
||||
| | SCHEMA | |
|
||||
| | ... | |
|
||||
| | FILE | |
|
||||
| | ... | |
|
||||
| +----------------------------------------------+ |
|
||||
@@ -28,7 +30,7 @@ Helder is built to run from the keyboard. Press `?` to see a short list of the m
|
||||
```
|
||||
|
||||
1. **Header**: a question-mark icon, the title and an `esc` chip.
|
||||
2. **Group label**: NAVIGATE, AGENT, GIT and FILE.
|
||||
2. **Group label**: NAVIGATE, AGENT, GIT, SCHEMA and FILE.
|
||||
3. **Row**: the keys as keycaps, then what they do.
|
||||
|
||||
## Features
|
||||
@@ -37,10 +39,11 @@ Helder is built to run from the keyboard. Press `?` to see a short list of the m
|
||||
- Open it with `?` when no text field, code view or terminal has the keyboard. You can also click the `?` button in the [title bar](title-bar.md), or choose View > Keyboard Shortcuts or Help > Keyboard Shortcuts.
|
||||
- Close it with `Esc`, or by clicking the dimmed backdrop.
|
||||
- It scrolls only when the window is too short to show all of it.
|
||||
- It holds the main shortcuts, in four groups:
|
||||
- It holds the main shortcuts, in five groups:
|
||||
- **Navigate**: search, list movement, column movement, the Explorer row cursor, the column toggles `Cmd+1` to `Cmd+3`, recent projects, open folder, new window, PHP class lookup, and this list.
|
||||
- **Agent**: pass the selection to the agent.
|
||||
- **Git**: open or close the Git view, focus the commit message, commit, push.
|
||||
- **Schema**: open or close the Schema view (Laravel apps), and `Return` in its table search.
|
||||
- **File**: save, Markdown preview, close, refresh, hidden files, select all, Fluid columns, zoom, and `Esc`.
|
||||
- The full reference is below.
|
||||
|
||||
@@ -48,8 +51,8 @@ Helder is built to run from the keyboard. Press `?` to see a short list of the m
|
||||
- A text field, the code, or a terminal keeps the keys it needs. Arrows, `Return`, `?`, `Cmd+A` and `Cmd+C` with a selection go to the field, not to Helder.
|
||||
- Keys with `Ctrl` or `Opt` always go to the field or terminal, except the menu shortcuts that use them.
|
||||
- While an overlay is open, it owns the keys. `Esc` closes it. The Diff is the exception: the workspace shortcuts keep working over it.
|
||||
- `Esc` closes the topmost layer: a right-click menu, a dialog, search or the Diff first, then the [Git](git.md) view. With none of those open, `Esc` goes to the terminal.
|
||||
- While the Git view is open, the column keys rest: arrows, `Return` and `Cmd+Left` / `Cmd+Right` do nothing in the columns under it.
|
||||
- `Esc` closes the topmost layer: a right-click menu, a dialog, search or the Diff first, then the [Schema](schema.md) view's selection, its search text and the view itself, or the [Git](git.md) view. With none of those open, `Esc` goes to the terminal.
|
||||
- While the Git or Schema view is open, the column keys rest: arrows, `Return` and `Cmd+Left` / `Cmd+Right` do nothing in the columns under it.
|
||||
|
||||
## Keyboard
|
||||
|
||||
@@ -104,6 +107,15 @@ See [Git](git.md) and [Git commit form](git-commit-form.md).
|
||||
| `Return` | Run the command in the console input |
|
||||
| `Up` | Recall the previous console command |
|
||||
|
||||
### Schema view
|
||||
See [Schema](schema.md). Only in a Laravel app: a project with an `artisan` file.
|
||||
|
||||
| Keys | Action |
|
||||
|---|---|
|
||||
| `Cmd+D` | Open or close the Schema view |
|
||||
| `Return` | In the table search: select and centre the first match |
|
||||
| `Esc` | Deselect the table, then clear the search (while it has the keyboard), then close the view |
|
||||
|
||||
### Explorer
|
||||
See [Explorer](explorer.md).
|
||||
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
# Schema
|
||||
|
||||
The Schema view is a full-screen diagram of a Laravel app's database: every table as a card, every foreign key as a line. Hover a table to trace what it points at and what points at it, click it to read its columns, and hand a table to Claude. Open it with `Cmd+D`.
|
||||
|
||||
[Guide index](index.md) · Related: [Git](git.md), [Title bar](title-bar.md), [Claude Code](claude-code.md), [Notifications](notifications.md)
|
||||
|
||||
## At a glance
|
||||
|
||||
```text
|
||||
+----------------------------------------------------------------------------+
|
||||
| (1) [ schema ] = mysql . shop dumped 14:32 . 16 tables . 23 relations |
|
||||
| app/Console/.../HelderSchemaCommand.php [>_ Re-run] [x] |
|
||||
|----------------------------------------------------------------------------|
|
||||
| (2) Q Find a table | (3) | (5) users x |
|
||||
| [ TABLES ] 16 | +-----------------+ | [ COLUMNS ] 8 |
|
||||
| |users 1,284 | | posts 312 | +-------+ | id bigint |
|
||||
| posts 312 | | PK id bigint | | users | | PRIMARY . NOT.. |
|
||||
| comments 9,812 | | FK user_id ----+--->| PK id | | [ HAS MANY ] |
|
||||
| | +-----------------+ +-------+ | <- posts via .. |
|
||||
| | (4) drag to pan ... [- 80% + Fit] | [Pass on][Copy] |
|
||||
|----------------------------------------------------------------------------|
|
||||
| (6) [ console ] artisan v |
|
||||
| $ php artisan helder:schema |
|
||||
| Wrote database/helder/schema.json (18.4 KB) |
|
||||
+----------------------------------------------------------------------------+
|
||||
```
|
||||
|
||||
1. **Top bar**: the database, when the dump was made, the command path, the Run button and Close.
|
||||
2. **Table list**: a search field and every table with its row count.
|
||||
3. **Canvas**: the table cards and the relationship lines.
|
||||
4. **Hint and zoom control**: how to move around, and zoom out, the zoom level, zoom in and Fit.
|
||||
5. **Detail panel**: the selected table's columns and relations, while a table is selected.
|
||||
6. **Console**: the output of `php artisan helder:schema`.
|
||||
|
||||
## Features
|
||||
|
||||
### When the view exists
|
||||
- Only in a Laravel app: a project with an `artisan` file in its root. Anywhere else there is no **Schema** button and `Cmd+D` does nothing.
|
||||
- The diagram comes from `database/helder/schema.json`. The app's own Artisan command `app/Console/Commands/HelderSchemaCommand.php` writes that file. See [the schema.json contract](../schema.md).
|
||||
|
||||
### Open and close the view
|
||||
- `Cmd+D`, the **Schema** toggle in the [Title bar](title-bar.md), or View > Show Schema opens it. The toggle's dot is amber while the view is open.
|
||||
- The view covers the whole window. The columns stay as they were under it, and terminals keep running.
|
||||
- Close it with `Cmd+D`, `Esc`, or the **Close** button. The keyboard goes back to the column that had it.
|
||||
- The Git view and the Schema view never show together: opening one closes the other.
|
||||
- The view is not remembered: a project always opens with it closed.
|
||||
|
||||
### No command yet
|
||||
A Laravel app without `HelderSchemaCommand.php` opens the view on `[ NO COMMAND YET ]`:
|
||||
|
||||
```text
|
||||
+--------------------------------------------------+
|
||||
| [ NO COMMAND YET ] |
|
||||
| - Helder draws the schema from |
|
||||
| database/helder/schema.json. The Artisan command|
|
||||
| app/Console/Commands/HelderSchemaCommand.php |
|
||||
| writes it, and this app does not have it yet. |
|
||||
| [* Generate command] [Copy prompt] |
|
||||
| +----------------------------------------------+ |
|
||||
| | Build an Artisan command that dumps ... | |
|
||||
| +----------------------------------------------+ |
|
||||
+--------------------------------------------------+
|
||||
```
|
||||
|
||||
- **Generate command** closes the view and puts a prompt in the Claude prompt. It does not send it: read it, then press `Return` yourself.
|
||||
- **Copy prompt** copies the same prompt, for another agent or a ticket.
|
||||
- The box below shows the whole prompt, so you know what Claude gets.
|
||||
- When Claude writes the command and runs it in the terminal, the view switches to the diagram by itself.
|
||||
|
||||
### No dump yet
|
||||
With the command but no `database/helder/schema.json`, the view shows `[ NO DUMP YET ]` and a **Run helder:schema** button. A dump that already exists loads as soon as the view opens.
|
||||
|
||||
### Run the command
|
||||
- **Run helder:schema** (or **Re-run helder:schema** once there is a dump) runs `php artisan helder:schema` in the project folder. Helder uses Laravel Herd's `php` when it is installed, else the `php` on your `PATH`.
|
||||
- While it runs, the button reads `Dumping…` and more clicks do nothing. A run stops after 120 seconds.
|
||||
- The console shows each line as it arrives: errors in amber, the `Wrote …` and `DONE` lines in teal.
|
||||
- When it succeeds, the diagram reloads and a [notification](notifications.md) reads `Schema dumped · 16 tables`.
|
||||
- When it fails, the console stays open with the error.
|
||||
- A `schema.json` that is not valid JSON shows its error in the console and the notification `Could not read the schema`.
|
||||
|
||||
### Table list
|
||||
- Type in **Find a table** to filter the list. `Return` selects and centres the first match. `Esc` clears the search, while the search has the keyboard.
|
||||
- The label reads `[ TABLES ] 16`, or `[ TABLES ] 3 of 16` while filtering.
|
||||
- Hover a row to trace that table on the canvas. Click a row to select it and move it to the middle.
|
||||
|
||||
### Move around the canvas
|
||||
- Drag the empty background, or scroll, to pan.
|
||||
- `Cmd` + scroll, `Ctrl` + scroll, or pinch to zoom around the pointer, from 30% to 200%.
|
||||
- The control at the bottom right: `−` and `+` zoom around the middle; **Fit** shows every table.
|
||||
- The first dump fits itself to the window. After that, a new dump keeps your view.
|
||||
|
||||
### Arrange the tables
|
||||
- Drag a card to move it. A press that hardly moves is a click.
|
||||
- Helder remembers where you put the cards, per project. A new dump keeps them; new tables get a default place.
|
||||
- The default places put tables that point at nothing on the left, and each other table one lane right of the deepest table it points at.
|
||||
|
||||
### Trace a relation
|
||||
- Hover a table: its lines turn amber, related tables get a grey outline and the rest fade.
|
||||
- Hover a foreign-key row (`FK`) to trace only that one relation.
|
||||
- With a search and nothing hovered or selected, matching cards get an amber outline and the rest fade.
|
||||
|
||||
### Inspect a table
|
||||
- Click a card to select it; the detail panel opens on the right. Click it again, or the empty canvas, to close it.
|
||||
- **[ COLUMNS ]** lists every column with its type and flags, such as `FK → users.id · NULL`.
|
||||
- **[ BELONGS TO ]** lists the tables this one points at; **[ HAS MANY ]** the tables that point at it. Hover a row to trace that table; click it to select it and move to it.
|
||||
- **Pass on to Claude** closes the view and puts `@schema:<table>` in the Claude prompt.
|
||||
- **Copy name** copies the table name.
|
||||
|
||||
### Console
|
||||
- It opens on the first run, at the bottom, and keeps the last 400 lines.
|
||||
- The chevron hides it until the next run.
|
||||
|
||||
### How the view stays up to date
|
||||
You do not need to refresh by hand. Helder watches the project folder: when the command file appears or goes, or `database/helder/schema.json` changes, the view follows. `Cmd+R` checks again too.
|
||||
|
||||
## Keyboard
|
||||
|
||||
| Keys | Action |
|
||||
|---|---|
|
||||
| `Cmd+D` | Open or close the Schema view (Laravel apps) |
|
||||
| `Return` | In the table search: select and centre the first match |
|
||||
| `Esc` | Deselect the table, then clear the search (while it has the keyboard), then close the view |
|
||||
| `Cmd+G` | Switch to the Git view |
|
||||
|
||||
## Related
|
||||
|
||||
- [Git](git.md): the other full-screen view.
|
||||
- [Title bar](title-bar.md): the **Schema** toggle.
|
||||
- [Claude Code](claude-code.md): where the prompt and `@schema:<table>` land.
|
||||
- [The schema.json contract](../schema.md): the file the command writes.
|
||||
- [Keyboard shortcuts](keyboard-shortcuts.md): every shortcut in one list.
|
||||
+12
-8
@@ -1,6 +1,6 @@
|
||||
# Title bar
|
||||
|
||||
The title bar is the 44-point strip across the top of a project window. It tells you which project, branch and file you are on, and holds the column toggles, the Git toggle and the main tools.
|
||||
The title bar is the 44-point strip across the top of a project window. It tells you which project, branch and file you are on, and holds the column toggles, the Git and Schema toggles and the main tools.
|
||||
|
||||
[Guide index](index.md) · Related: [Window layout](layout.md), [Search](search.md), [Keyboard shortcuts](keyboard-shortcuts.md)
|
||||
|
||||
@@ -11,8 +11,8 @@ The title bar is the 44-point strip across the top of a project window. It tells
|
||||
| o o o Helder. shop . main app > Http > User.php * |
|
||||
| (1) (2) (3) (4) (5) (6) |
|
||||
| |
|
||||
| [.Explorer|.File|.Claude] [Git 3 |Search |.Fluid |.Hidden] [?] |
|
||||
| (7) (8) (9) (10) (10) (11) |
|
||||
| [.Explorer|.File|.Claude] [Git 3 |.Schema |Search |.Fluid |.Hidden] [?] |
|
||||
| (7) (8) (9) (10) (11) (11) (12) |
|
||||
+----------------------------------------------------------------------------+
|
||||
```
|
||||
|
||||
@@ -21,7 +21,7 @@ The bar is one row in the app. It is drawn on two rows here to fit the page.
|
||||
While Helder reads aloud, a **Stop** button leads the toolbar:
|
||||
|
||||
```text
|
||||
| [.Stop |Git 3 |Search |.Fluid |.Hidden] [?] |
|
||||
| [.Stop |Git 3 |.Schema |Search |.Fluid |.Hidden] [?] |
|
||||
```
|
||||
|
||||
1. **Window buttons**: the macOS close, minimize and zoom buttons.
|
||||
@@ -32,9 +32,10 @@ While Helder reads aloud, a **Stop** button leads the toolbar:
|
||||
6. **Unsaved dot**: an amber dot when the open file has unsaved edits.
|
||||
7. **Pane toggles**: each shows or hides one column.
|
||||
8. **Git N**: opens and closes the Git view.
|
||||
9. **Search**: a button that opens an overlay.
|
||||
10. **Fluid** and **Hidden**: on/off toggles.
|
||||
11. **`?`**: opens the keyboard shortcuts.
|
||||
9. **Schema**: opens and closes the Schema view, in a Laravel app only.
|
||||
10. **Search**: a button that opens an overlay.
|
||||
11. **Fluid** and **Hidden**: on/off toggles.
|
||||
12. **`?`**: opens the keyboard shortcuts.
|
||||
|
||||
## Features
|
||||
|
||||
@@ -63,12 +64,13 @@ While Helder reads aloud, a **Stop** button leads the toolbar:
|
||||
The toolbar sits on the right. Each button shows its shortcut next to its label.
|
||||
|
||||
- **Git N** (`Cmd+G`): opens the full-screen [Git](git.md) view. N counts the changed files; a file that is both staged and unstaged counts once. With no changes it reads **Git**. The view covers the title bar, so close it with `Cmd+G`, `Esc` or its own **Close** button.
|
||||
- **Schema** (`Cmd+D`): opens the full-screen [Schema](schema.md) view, the database diagram. It shows only in a Laravel app: a project with an `artisan` file in its root. Opening it closes the Git view, and the other way round.
|
||||
- **Search** (`Cmd+F`): opens search over the open file, the project contents and the file names. See [Search](search.md).
|
||||
- **Fluid** (`Cmd+L`): when on, the columns re-fit on resize and when focus moves. When off, they keep their size. See [Window layout](layout.md).
|
||||
- **Hidden** (`Cmd+.`): when on, dotfiles appear in the Explorer and in search.
|
||||
- **`?`**: opens the keyboard shortcuts list. See [Keyboard shortcuts](keyboard-shortcuts.md).
|
||||
|
||||
Git, Fluid and Hidden carry a state dot like the pane toggles; Git's dot is on while the view is open. Search has no dot, because it is an action. Hover any button for a tooltip that explains its current state.
|
||||
Git, Schema, Fluid and Hidden carry a state dot like the pane toggles; the Git and Schema dots are on while their view is open. Search has no dot, because it is an action. Hover any button for a tooltip that explains its current state.
|
||||
|
||||
### Read aloud
|
||||
- **Stop** shows only while Helder reads a file or a selection aloud. Start the reading from the [right-click menu](right-click-menu.md): **Read aloud** on a Markdown file, **Read aloud selection** in the code.
|
||||
@@ -87,6 +89,7 @@ Drag an empty part of the title bar to move the window, as in any macOS app.
|
||||
| `Cmd+L` | Fluid column widths on or off |
|
||||
| `Cmd+.` | Hidden files on or off |
|
||||
| `Cmd+G` | Open or close the Git view |
|
||||
| `Cmd+D` | Open or close the Schema view (Laravel apps) |
|
||||
| `Cmd+1` / `Cmd+2` / `Cmd+3` | Explorer, File or Claude column on or off |
|
||||
| `?` | Keyboard shortcuts (when no text field has focus) |
|
||||
| `Cmd+O` | Open a folder (same as clicking the project name) |
|
||||
@@ -95,6 +98,7 @@ Drag an empty part of the title bar to move the window, as in any macOS app.
|
||||
|
||||
- [Window layout](layout.md): what the pane toggles, Fluid and Hidden do to the columns.
|
||||
- [Git](git.md): the view the Git toggle opens.
|
||||
- [Schema](schema.md): the view the Schema toggle opens.
|
||||
- [Search](search.md): the overlay the Search button opens.
|
||||
- [Keyboard shortcuts](keyboard-shortcuts.md): the overlay the `?` button opens.
|
||||
- [Recent projects](recent-projects.md): opening another folder.
|
||||
|
||||
Reference in New Issue
Block a user