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
+343 -3
View File
@@ -316,6 +316,141 @@
</div>
</sc-if>
<!-- schema overlay -->
<sc-if value="{{ schemaOpen }}" hint-placeholder-val="{{ false }}">
<div data-screen-label="Schema" style="position:fixed;inset:0;background:#101720;z-index:45;display:flex;flex-direction:column;min-width:900px">
<div style="height:44px;flex:none;background:#18202B;border-bottom:1px solid #232C39;display:flex;align-items:center;gap:14px;padding:0 14px">
<span style="font:700 11px/1 'IBM Plex Mono',monospace;letter-spacing:.14em;text-transform:uppercase;color:#828D9A;white-space:nowrap">[ schema ]</span>
<span style="display:flex;align-items:center;gap:6px;font:500 12px/1 'IBM Plex Mono',monospace;color:#E8913A;white-space:nowrap"><x-import component-from-global-scope="BlijnderKadeDesignSystem_e2fd65.Icon" name="database" size="{{ 13 }}" hint-size="13px,13px"></x-import>mysql · odynt</span>
<span style="font:400 12px/1 'IBM Plex Mono',monospace;color:#828D9A;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0">{{ sMeta }}</span>
<span style="flex:1"></span>
<button type="button" title="Open the command in the editor" onClick="{{ openSchemaCmd }}" style="border:none;background:transparent;padding:4px 0;font:400 12px/1 'IBM Plex Mono',monospace;color:#828D9A;cursor:pointer;white-space:nowrap" style-hover="color:#F4F5F4">app/Console/Commands/HelderSchemaCommand.php</button>
<button type="button" onClick="{{ runSchema }}" style="display:flex;align-items:center;gap:7px;height:28px;padding:0 12px;border:none;border-radius:2px;background:#E8913A;color:#101720;font:600 12px/1 'IBM Plex Sans',sans-serif;cursor:pointer;white-space:nowrap" style-hover="background:#C4741F"><x-import component-from-global-scope="BlijnderKadeDesignSystem_e2fd65.Icon" name="terminal" size="{{ 14 }}" hint-size="14px,14px"></x-import>{{ sRunLabel }}</button>
<button type="button" onClick="{{ closeSchema }}" style="display:flex;align-items:center;gap:7px;height:28px;padding:0 11px;border:1px solid #232C39;border-radius:2px;background:transparent;color:#BAC0C0;font:500 12px/1 'IBM Plex Sans',sans-serif;cursor:pointer;white-space:nowrap" style-hover="color:#F4F5F4;border-color:#3A424C"><x-import component-from-global-scope="BlijnderKadeDesignSystem_e2fd65.Icon" name="minimize-2" size="{{ 14 }}" hint-size="14px,14px"></x-import>Close<span style="font:600 11px/1 'IBM Plex Mono',monospace;color:#E8913A">⌘D</span></button>
</div>
<div style="flex:1;min-height:0;display:flex">
<sc-if value="{{ hasSchema }}" hint-placeholder-val="{{ false }}">
<div style="width:240px;flex:none;border-right:1px solid #232C39;background:#18202B;display:flex;flex-direction:column;min-height:0">
<div style="height:44px;flex:none;display:flex;align-items:center;gap:8px;padding:0 12px 0 14px;border-bottom:1px solid #232C39">
<span style="color:#828D9A;display:flex"><x-import component-from-global-scope="BlijnderKadeDesignSystem_e2fd65.Icon" name="search" size="{{ 14 }}" hint-size="14px,14px"></x-import></span>
<input value="{{ sQ }}" onChange="{{ onSQ }}" onKeyDown="{{ onSQKey }}" placeholder="Find a table" spellCheck="false" style="flex:1;min-width:0;border:none;outline:none;background:transparent;padding:0;font:400 13px/1 'IBM Plex Mono',monospace;color:#F4F5F4">
</div>
<div style="height:34px;flex:none;display:flex;align-items:center;padding:0 14px;font:700 10px/1 'IBM Plex Mono',monospace;letter-spacing:.14em;text-transform:uppercase;color:#6C7783">{{ sListLabel }}</div>
<div style="flex:1;min-height:0;overflow:auto;padding-bottom:12px;display:flex;flex-direction:column">
<sc-for list="{{ sList }}" as="it" hint-placeholder-count="8">
<button type="button" onClick="{{ it.onClick }}" onMouseEnter="{{ it.onEnter }}" onMouseLeave="{{ it.onLeave }}" style="height:30px;flex:none;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:8px;padding:0 14px 0 11px;border:none;border-left:3px solid {{ it.bar }};background:{{ it.bg }};text-align:left;cursor:pointer" style-hover="background:#1F2834">
<span style="font:400 12px/1 'IBM Plex Mono',monospace;color:{{ it.color }};overflow:hidden;text-overflow:ellipsis;white-space:nowrap">{{ it.name }}</span>
<span style="font:400 11px/1 'IBM Plex Mono',monospace;color:#6C7783;white-space:nowrap">{{ it.rows }}</span>
</button>
</sc-for>
</div>
</div>
</sc-if>
<div ref="{{ schemaCanvasRef }}" onMouseDown="{{ sBgDown }}" style="position:relative;flex:1;min-width:0;overflow:hidden;background:#101720;cursor:{{ sCursor }}">
<sc-if value="{{ noSchema }}" hint-placeholder-val="{{ true }}">
<div style="position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding:24px">
<div style="max-width:440px;display:flex;flex-direction:column;gap:16px">
<span style="font:700 11px/1 'IBM Plex Mono',monospace;letter-spacing:.14em;text-transform:uppercase;color:#E8913A">[ no dump yet ]</span>
<div style="font:400 15px/1.6 'IBM Plex Sans',sans-serif;color:#BAC0C0;text-wrap:pretty">— Helder draws the schema from <span style="font-family:'IBM Plex Mono',monospace;color:#F4F5F4">storage/helder/schema.json</span>. Run the command to write it.</div>
<div style="display:flex;align-items:center;gap:14px;flex-wrap:wrap">
<button type="button" onClick="{{ runSchema }}" style="height:36px;padding:0 16px;border:none;border-radius:2px;background:#E8913A;color:#101720;font:600 13px/1 'IBM Plex Sans',sans-serif;cursor:pointer" style-hover="background:#C4741F">{{ sRunLabel }}</button>
<span style="font:400 12px/1 'IBM Plex Mono',monospace;color:#6C7783">$ php artisan helder:schema</span>
</div>
</div>
</div>
</sc-if>
<sc-if value="{{ hasSchema }}" hint-placeholder-val="{{ false }}">
<div style="position:absolute;left:0;top:0;transform-origin:0 0;transform:{{ sTransform }}">
{{ sEdgesEl }}
<sc-for list="{{ sTables }}" as="t" hint-placeholder-count="0">
<div onMouseDown="{{ t.onDown }}" onMouseEnter="{{ t.onEnter }}" onMouseLeave="{{ t.onLeave }}" style="position:absolute;left:{{ t.x }}px;top:{{ t.y }}px;width:240px;box-sizing:border-box;background:#18202B;border:1px solid {{ t.border }};border-radius:4px;opacity:{{ t.op }};cursor:{{ t.cursor }};user-select:none;transition:opacity 160ms cubic-bezier(0.22,1,0.36,1),border-color 160ms cubic-bezier(0.22,1,0.36,1)">
<div style="height:33px;box-sizing:border-box;border-bottom:1px solid #232C39;display:flex;align-items:center;gap:8px;padding:0 10px;background:{{ t.headBg }}">
<span style="flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:700 12px/1 'IBM Plex Mono',monospace;color:{{ t.nameColor }}">{{ t.name }}</span>
<span style="font:400 11px/1 'IBM Plex Mono',monospace;color:#6C7783;white-space:nowrap">{{ t.rows }}</span>
</div>
<sc-for list="{{ t.cols }}" as="c" hint-placeholder-count="4">
<div onMouseEnter="{{ c.onEnter }}" onMouseLeave="{{ c.onLeave }}" style="height:22px;display:grid;grid-template-columns:20px minmax(0,1fr) auto;align-items:center;gap:6px;padding:0 10px;background:{{ c.bg }}">
<span style="font:700 9px/1 'IBM Plex Mono',monospace;letter-spacing:.06em;color:{{ c.keyColor }}">{{ c.key }}</span>
<span style="font:400 12px/1 'IBM Plex Mono',monospace;color:{{ c.nameColor }};overflow:hidden;text-overflow:ellipsis;white-space:nowrap">{{ c.n }}</span>
<span style="font:400 11px/1 'IBM Plex Mono',monospace;color:#6C7783;white-space:nowrap">{{ c.t }}</span>
</div>
</sc-for>
</div>
</sc-for>
</div>
<div style="position:absolute;left:14px;bottom:14px;font:400 11px/1 'IBM Plex Mono',monospace;color:#6C7783;pointer-events:none">drag to pan · ⌘ scroll to zoom · hover a table or a key to trace it · click to inspect</div>
<div onMouseDown="{{ sStop }}" style="position:absolute;right:14px;bottom:14px;display:flex;border:1px solid #232C39;border-radius:2px;background:#18202B;overflow:hidden">
<button type="button" title="Zoom out" onClick="{{ sZoomOut }}" style="width:30px;height:28px;border:none;background:transparent;color:#BAC0C0;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0" style-hover="color:#F4F5F4;background:#232C39"><x-import component-from-global-scope="BlijnderKadeDesignSystem_e2fd65.Icon" name="minus" size="{{ 14 }}" hint-size="14px,14px"></x-import></button>
<span style="width:52px;display:flex;align-items:center;justify-content:center;border-left:1px solid #232C39;border-right:1px solid #232C39;font:500 11px/1 'IBM Plex Mono',monospace;color:#828D9A">{{ sZoomPct }}</span>
<button type="button" title="Zoom in" onClick="{{ sZoomIn }}" style="width:30px;height:28px;border:none;background:transparent;color:#BAC0C0;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0" style-hover="color:#F4F5F4;background:#232C39"><x-import component-from-global-scope="BlijnderKadeDesignSystem_e2fd65.Icon" name="plus" size="{{ 14 }}" hint-size="14px,14px"></x-import></button>
<button type="button" title="Fit the whole schema" onClick="{{ sFitAll }}" style="height:28px;padding:0 11px;border:none;border-left:1px solid #232C39;background:transparent;color:#BAC0C0;cursor:pointer;font:500 12px/1 'IBM Plex Sans',sans-serif" style-hover="color:#F4F5F4;background:#232C39">Fit</button>
</div>
</sc-if>
</div>
<sc-if value="{{ sHasSel }}" hint-placeholder-val="{{ false }}">
<div style="width:320px;flex:none;border-left:1px solid #232C39;background:#18202B;display:flex;flex-direction:column;min-height:0">
<div style="height:44px;flex:none;display:flex;align-items:center;gap:10px;padding:0 10px 0 16px;border-bottom:1px solid #232C39">
<span style="flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:700 13px/1 'IBM Plex Mono',monospace;color:#F4F5F4">{{ selName }}</span>
<span style="font:400 11px/1 'IBM Plex Mono',monospace;color:#828D9A;white-space:nowrap">{{ selRows }}</span>
<button type="button" title="Close (Esc)" onClick="{{ closeSel }}" style="border:none;background:transparent;color:#828D9A;cursor:pointer;padding:4px;display:flex" style-hover="color:#F4F5F4"><x-import component-from-global-scope="BlijnderKadeDesignSystem_e2fd65.Icon" name="x" size="{{ 14 }}" hint-size="14px,14px"></x-import></button>
</div>
<div style="flex:1;min-height:0;overflow:auto;display:flex;flex-direction:column;gap:20px;padding:14px 0 20px">
<div style="display:flex;flex-direction:column">
<div style="padding:0 16px 8px;font:700 10px/1 'IBM Plex Mono',monospace;letter-spacing:.14em;text-transform:uppercase;color:#6C7783">[ columns ] {{ selColCount }}</div>
<sc-for list="{{ selCols }}" as="c" hint-placeholder-count="6">
<div style="display:grid;grid-template-columns:minmax(0,1fr) auto;gap:2px 10px;padding:7px 16px;border-top:1px solid #232C39">
<span style="font:500 12px/1.4 'IBM Plex Mono',monospace;color:#E4E7E6;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">{{ c.n }}</span>
<span style="font:400 11px/1.4 'IBM Plex Mono',monospace;color:#828D9A;white-space:nowrap">{{ c.t }}</span>
<span style="grid-column:1 / -1;font:400 11px/1.4 'IBM Plex Mono',monospace;color:{{ c.flagColor }}">{{ c.flag }}</span>
</div>
</sc-for>
</div>
<sc-if value="{{ selHasOut }}" hint-placeholder-val="{{ false }}">
<div style="display:flex;flex-direction:column">
<div style="padding:0 16px 8px;font:700 10px/1 'IBM Plex Mono',monospace;letter-spacing:.14em;text-transform:uppercase;color:#6C7783">[ belongs to ]</div>
<sc-for list="{{ selOut }}" as="r" hint-placeholder-count="2">
<button type="button" onClick="{{ r.onClick }}" onMouseEnter="{{ r.onEnter }}" onMouseLeave="{{ r.onLeave }}" style="display:flex;align-items:center;gap:8px;padding:8px 16px;border:none;border-top:1px solid #232C39;background:transparent;text-align:left;cursor:pointer;font:400 12px/1 'IBM Plex Mono',monospace" style-hover="background:#1F2834"><span style="color:#E8913A">→</span><span style="color:#F4F5F4">{{ r.table }}</span><span style="flex:1"></span><span style="color:#828D9A">via {{ r.via }}</span></button>
</sc-for>
</div>
</sc-if>
<sc-if value="{{ selHasIn }}" hint-placeholder-val="{{ false }}">
<div style="display:flex;flex-direction:column">
<div style="padding:0 16px 8px;font:700 10px/1 'IBM Plex Mono',monospace;letter-spacing:.14em;text-transform:uppercase;color:#6C7783">[ has many ]</div>
<sc-for list="{{ selIn }}" as="r" hint-placeholder-count="2">
<button type="button" onClick="{{ r.onClick }}" onMouseEnter="{{ r.onEnter }}" onMouseLeave="{{ r.onLeave }}" style="display:flex;align-items:center;gap:8px;padding:8px 16px;border:none;border-top:1px solid #232C39;background:transparent;text-align:left;cursor:pointer;font:400 12px/1 'IBM Plex Mono',monospace" style-hover="background:#1F2834"><span style="color:#E8913A">←</span><span style="color:#F4F5F4">{{ r.table }}</span><span style="flex:1"></span><span style="color:#828D9A">via {{ r.via }}</span></button>
</sc-for>
</div>
</sc-if>
<sc-if value="{{ selNoRel }}" hint-placeholder-val="{{ false }}">
<div style="padding:0 16px;font:400 13px/1.6 'IBM Plex Sans',sans-serif;color:#828D9A">— No foreign keys in or out.</div>
</sc-if>
</div>
<div style="flex:none;display:flex;gap:8px;padding:12px 16px;border-top:1px solid #232C39">
<button type="button" onClick="{{ selPass }}" style="flex:1;height:30px;border:1px solid #3A424C;border-radius:2px;background:transparent;color:#BAC0C0;font:500 12px/1 'IBM Plex Sans',sans-serif;cursor:pointer" style-hover="border-color:#6C7783;background:#232C39;color:#F4F5F4">Pass on to Claude</button>
<button type="button" onClick="{{ selCopy }}" style="flex:1;height:30px;border:1px solid #3A424C;border-radius:2px;background:transparent;color:#BAC0C0;font:500 12px/1 'IBM Plex Sans',sans-serif;cursor:pointer" style-hover="border-color:#6C7783;background:#232C39;color:#F4F5F4">Copy name</button>
</div>
</div>
</sc-if>
</div>
<sc-if value="{{ hasSlog }}" hint-placeholder-val="{{ false }}">
<div style="height:150px;flex:none;border-top:1px solid #232C39;background:#18202B;display:flex;flex-direction:column;min-height:0">
<div style="height:32px;flex:none;display:flex;align-items:center;gap:12px;padding:0 12px 0 16px;font:700 10px/1 'IBM Plex Mono',monospace;letter-spacing:.14em;text-transform:uppercase;color:#6C7783">
<span>[ console ] artisan</span>
<span style="flex:1"></span>
<button type="button" title="Hide console" onClick="{{ hideSlog }}" style="border:none;background:transparent;color:#828D9A;cursor:pointer;padding:4px;display:flex" style-hover="color:#F4F5F4"><x-import component-from-global-scope="BlijnderKadeDesignSystem_e2fd65.Icon" name="chevron-down" size="{{ 14 }}" hint-size="14px,14px"></x-import></button>
</div>
<div style="flex:1;min-height:0;overflow:auto;display:flex;flex-direction:column-reverse;padding:0 16px 12px">
<div style="font:400 12px/1.6 'IBM Plex Mono',monospace">
<sc-for list="{{ slogLines }}" as="l" hint-placeholder-count="3">
<div style="white-space:pre-wrap;word-break:break-all;color:{{ l.color }}">{{ l.t }}</div>
</sc-for>
</div>
</div>
</div>
</sc-if>
</div>
</sc-if>
<!-- git overlay -->
<sc-if value="{{ gitOpen }}" hint-placeholder-val="{{ false }}">
<div style="position:fixed;inset:0;background:#101720;z-index:44;display:flex;flex-direction:column;min-width:900px">
@@ -808,6 +943,46 @@ exit($status);`);
Expertise infrastructure for independent experts.
Run \`composer run dev\` and open https://odynt.test.`);
put('app/Console/Commands/HelderSchemaCommand.php', `<?php
namespace App\\Console\\Commands;
use Illuminate\\Console\\Command;
use Illuminate\\Support\\Facades\\File;
use Illuminate\\Support\\Facades\\Schema;
class HelderSchemaCommand extends Command
{
protected $signature = 'helder:schema {--connection= : Database connection to read}';
protected $description = 'Dump the database schema for Helder to visualise.';
public function handle(): int
{
$connection = $this->option('connection') ?? config('database.default');
$schema = Schema::connection($connection);
$tables = collect($schema->getTables())
->reject(fn ($t) => in_array($t['name'], ['migrations', 'jobs', 'cache', 'sessions']))
->map(fn ($t) => [
'name' => $t['name'],
'columns' => $schema->getColumns($t['name']),
'indexes' => $schema->getIndexes($t['name']),
'foreign_keys' => $schema->getForeignKeys($t['name']),
])->values();
File::ensureDirectoryExists(storage_path('helder'));
File::put(storage_path('helder/schema.json'), json_encode([
'connection' => $connection,
'generated_at' => now()->toIso8601String(),
'tables' => $tables,
], JSON_PRETTY_PRINT));
$this->components->info('Schema dumped to storage/helder/schema.json');
return self::SUCCESS;
}
}`);
put('vite.config.js', `import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
@@ -843,6 +1018,7 @@ AI_MODEL=claude-opus-5-5`);
{ t: 'Environment reset and seeded successfully.', c: '#8FBFB4' }
], termInput: '', history: [],
commits: [], ahead: 0, commitMsg: '', note: '',
schemaOpen: false, schema: null, sPos: {}, sView: { x: 0, y: 0, k: 1 }, sHover: null, sCol: null, sSel: null, sQ: '', slog: [], slogOpen: true, sBusy: false, sDumped: null, sDragging: null,
gitOpen: false, gitSec: {}, branches: [BR, 'main', 'ontwikkeling/2026-09-28-004-vault-sharing'], remotes: ['main', BR, 'ontwikkeling/2026-09-28-004-vault-sharing', 'ontwikkeling/2026-10-02-005-mcp-rate-limits', 'release/2026.10'], gitOpenFiles: [], behind: 2, pulled: false, gBusy: null, gInput: '', gHist: [],
glog: [{ t: '$ git fetch origin', c: '#F4F5F4' }, { t: 'From github.com:blijnder/odynt', c: '#BAC0C0' }, { t: ' 4be21a9..7a1e0f2 ' + BR + ' -> origin/' + BR, c: '#BAC0C0' }]
};
@@ -986,8 +1162,169 @@ return [
push() { const a = this.state.ahead; if (!a) { this.toast('— Nothing to push. Branch is up to date.'); return; } this.setState({ ahead: 0 }); this.toast('Pushed ' + a + (a === 1 ? ' commit' : ' commits') + ' to origin/' + this.state.BR); }
openDiff(p) { this.setState({ menu: null, diffPath: p }); }
// ---------- schema (full screen, only when the app has helder:schema) ----------
CMD = 'app/Console/Commands/HelderSchemaCommand.php';
hasSchemaCmd() { const f = this.state.files[this.CMD]; return !!(f && f.content !== null); }
toggleSchema() { const o = !this.state.schemaOpen; this.setState({ schemaOpen: o, gitOpen: false, menu: null }); }
schemaData() {
const T = [
[0, 'team_user', 1590, 'id:bigint:pk|team_id:bigint:fk=teams|user_id:bigint:fk=users|role:varchar(32)|created_at:timestamp:null'],
[0, 'mcp_tokens', 88, 'id:bigint:pk|user_id:bigint:fk=users|agent_id:bigint:fk=agents:null|name:varchar(255)|token_hash:char(64):uq|last_used_at:timestamp:null|revoked_at:timestamp:null|created_at:timestamp:null'],
[1, 'users', 1284, 'id:bigint:pk|name:varchar(255)|email:varchar(255):uq|email_verified_at:timestamp:null|password:varchar(255)|current_team_id:bigint:fk=teams:null|created_at:timestamp:null|updated_at:timestamp:null'],
[1, 'teams', 312, 'id:bigint:pk|user_id:bigint:fk=users|name:varchar(255)|personal_team:bool|created_at:timestamp:null|updated_at:timestamp:null'],
[2, 'agents', 146, 'id:bigint:pk|team_id:bigint:fk=teams|name:varchar(255)|slug:varchar(255):uq|model:varchar(64)|system_prompt:text|compression:varchar(16)|cache_history:bool|created_at:timestamp:null|updated_at:timestamp:null'],
[2, 'agent_vault', 402, 'agent_id:bigint:fk=agents|vault_id:bigint:fk=vaults|usage_scope:varchar(16)'],
[2, 'conversations', 9812, 'id:bigint:pk|agent_id:bigint:fk=agents|user_id:bigint:fk=users|title:varchar(255):null|created_at:timestamp:null|updated_at:timestamp:null'],
[2, 'messages', 214330, 'id:bigint:pk|conversation_id:bigint:fk=conversations|role:varchar(16)|content:longtext|input_tokens:int:null|output_tokens:int:null|cache_read_tokens:int:null|created_at:timestamp:null'],
[3, 'vaults', 97, 'id:bigint:pk|team_id:bigint:fk=teams|name:varchar(255)|mcp_accessible:bool|created_at:timestamp:null|updated_at:timestamp:null'],
[3, 'vault_documents', 3410, 'id:bigint:pk|vault_id:bigint:fk=vaults|title:varchar(255)|path:varchar(255)|mime:varchar(64)|bytes:int|created_at:timestamp:null'],
[3, 'document_chunks', 61207, 'id:bigint:pk|vault_document_id:bigint:fk=vault_documents|position:int|content:text|embedding:vector(1536)'],
[4, 'flows', 54, 'id:bigint:pk|team_id:bigint:fk=teams|name:varchar(255)|trigger:varchar(32)|created_at:timestamp:null|updated_at:timestamp:null'],
[4, 'flow_steps', 211, 'id:bigint:pk|flow_id:bigint:fk=flows|agent_id:bigint:fk=agents|position:int|instructions:text'],
[4, 'flow_runs', 7020, 'id:bigint:pk|flow_id:bigint:fk=flows|user_id:bigint:fk=users:null|status:varchar(16)|started_at:timestamp|finished_at:timestamp:null'],
[4, 'flow_connector', 61, 'flow_id:bigint:fk=flows|connector_id:bigint:fk=connectors'],
[4, 'connectors', 39, 'id:bigint:pk|team_id:bigint:fk=teams|type:varchar(32)|name:varchar(255)|credentials:text|created_at:timestamp:null']
];
const tables = [], edges = [], pos = {}, laneY = [0, 0, 0, 0, 0], lane = {};
T.forEach(([ln, name, rows, spec]) => {
const cols = spec.split('|').map(c => { const [n, t, ...f] = c.split(':'); const fk = (f.find(x => x.startsWith('fk=')) || '').slice(3) || null; return { n, t, pk: f.includes('pk'), uq: f.includes('uq'), nul: f.includes('null'), fk }; });
cols.forEach((c, ci) => { if (c.fk) edges.push({ from: name, col: c.n, ci, to: c.fk }); });
tables.push({ name, rows, cols }); lane[name] = ln; pos[name] = { x: 40 + ln * 340, y: laneY[ln] }; laneY[ln] += 35 + cols.length * 22 + 48;
});
const maxH = Math.max(...laneY);
tables.forEach(t => { pos[t.name].y += 40 + Math.round((maxH - laneY[lane[t.name]]) / 2); });
return { schema: { tables, edges }, pos };
}
sTmap() { const m = {}; (this.state.schema ? this.state.schema.tables : []).forEach(t => { m[t.name] = t; }); return m; }
sPath(e, pos, tm) {
const W = 240, a = pos[e.from], b = pos[e.to], bi = Math.max(0, tm[e.to].cols.findIndex(c => c.pk));
const y1 = a.y + 45 + e.ci * 22, y2 = b.y + 45 + bi * 22, ac = a.x + W / 2, bc = b.x + W / 2;
let x1, x2, c1, c2;
if (Math.abs(ac - bc) < W) { x1 = a.x + W; x2 = b.x + W; const o = 46 + Math.abs(y2 - y1) * 0.12; c1 = x1 + o; c2 = x2 + o; }
else if (bc > ac) { x1 = a.x + W; x2 = b.x; const d = Math.max(40, (x2 - x1) / 2); c1 = x1 + d; c2 = x2 - d; }
else { x1 = a.x; x2 = b.x + W; const d = Math.max(40, (x1 - x2) / 2); c1 = x1 - d; c2 = x2 + d; }
return { d: 'M' + x1 + ',' + y1 + ' C' + c1 + ',' + y1 + ' ' + c2 + ',' + y2 + ' ' + x2 + ',' + y2, x1, y1, x2, y2 };
}
sBounds() {
const P = this.state.sPos; let x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity;
this.state.schema.tables.forEach(t => { const p = P[t.name]; x0 = Math.min(x0, p.x); y0 = Math.min(y0, p.y); x1 = Math.max(x1, p.x + 240); y1 = Math.max(y1, p.y + 35 + t.cols.length * 22); });
return { x0, y0, x1, y1 };
}
sRect() { return this._sc ? this._sc.getBoundingClientRect() : null; }
sFit() {
const r = this.sRect(); if (!r || !this.state.schema) return;
const b = this.sBounds(), bw = b.x1 - b.x0 + 60, bh = b.y1 - b.y0;
const k = Math.min(1.1, Math.max(0.3, Math.min((r.width - 96) / bw, (r.height - 96) / bh)));
this.setState({ sView: { k, x: (r.width - bw * k) / 2 - b.x0 * k, y: (r.height - bh * k) / 2 - b.y0 * k } });
}
sZoom(f, mx, my) {
const r = this.sRect(); if (!r) return; const v = this.state.sView, k = Math.min(2, Math.max(0.3, v.k * f));
if (mx == null) { mx = r.width / 2; my = r.height / 2; }
this.setState({ sView: { k, x: mx - (mx - v.x) * k / v.k, y: my - (my - v.y) * k / v.k } });
}
sCenter(name) {
const r = this.sRect(), t = this.sTmap()[name]; if (!r || !t) return;
const p = this.state.sPos[name], k = this.state.sView.k, w = r.width - (this.state.sSel ? 0 : 320);
this.setState({ sSel: name, sHover: null, sView: { k, x: Math.round(w / 2 - (p.x + 120) * k), y: Math.round(r.height / 2 - (p.y + (35 + t.cols.length * 22) / 2) * k) } });
}
schemaCanvasRef = el => {
if (this._sc && this._sc !== el) this._sc.removeEventListener('wheel', this.onSchemaWheel);
if (el && el !== this._sc) el.addEventListener('wheel', this.onSchemaWheel, { passive: false });
this._sc = el;
};
onSchemaWheel = ev => {
if (!this.state.schema) return; ev.preventDefault();
const r = this.sRect(), v = this.state.sView;
if (ev.ctrlKey || ev.metaKey) this.sZoom(Math.exp(-ev.deltaY * 0.01), ev.clientX - r.left, ev.clientY - r.top);
else this.setState({ sView: { ...v, x: v.x - ev.deltaX, y: v.y - ev.deltaY } });
};
sDown(ev, name) {
if (ev.button !== 0 || !this.state.schema) return; ev.stopPropagation();
const v = this.state.sView, p = name && this.state.sPos[name];
this.sDrag = name ? { mode: 't', name, sx: ev.clientX, sy: ev.clientY, ox: p.x, oy: p.y, moved: false } : { mode: 'p', sx: ev.clientX, sy: ev.clientY, vx: v.x, vy: v.y, moved: false };
window.addEventListener('mousemove', this.sMove); window.addEventListener('mouseup', this.sUp);
}
sMove = ev => {
const d = this.sDrag; if (!d) return; const dx = ev.clientX - d.sx, dy = ev.clientY - d.sy;
if (!d.moved) { if (Math.abs(dx) + Math.abs(dy) < 4) return; d.moved = true; this.setState({ sDragging: d.mode }); }
if (d.mode === 't') { const k = this.state.sView.k; this.setState(s => ({ sPos: { ...s.sPos, [d.name]: { x: Math.round(d.ox + dx / k), y: Math.round(d.oy + dy / k) } } })); }
else this.setState(s => ({ sView: { ...s.sView, x: d.vx + dx, y: d.vy + dy } }));
};
sUp = () => {
window.removeEventListener('mousemove', this.sMove); window.removeEventListener('mouseup', this.sUp);
const d = this.sDrag; this.sDrag = null; if (!d) return;
if (!d.moved) this.setState(s => ({ sSel: d.mode === 't' ? (s.sSel === d.name ? null : d.name) : null }));
this.setState({ sDragging: null });
};
schemaRun() {
if (this.state.sBusy) return;
const sp = this.speed(), { schema, pos } = this.schemaData(), nc = schema.tables.reduce((a, t) => a + t.cols.length, 0);
const add = (t, c) => this.setState(x => ({ slog: [...x.slog, { t, c: c || '#BAC0C0' }].slice(-200) }));
this.setState(x => ({ sBusy: true, slogOpen: true, slog: [...x.slog, { t: '$ php artisan helder:schema', c: '#F4F5F4' }] }));
[[260, ' Connection ............................ mysql · odynt'], [520, ' Tables ................................ ' + schema.tables.length], [700, ' Columns ............................... ' + nc], [880, ' Foreign keys .......................... ' + schema.edges.length], [1100, ' Wrote storage/helder/schema.json (18.4 KB)', '#8FBFB4']].forEach(([ms, t, c]) => this.later(() => add(t, c), ms * sp));
this.later(() => {
const first = !this.state.schema, d = new Date(), hm = String(d.getHours()).padStart(2, '0') + ':' + String(d.getMinutes()).padStart(2, '0');
add(' DONE Schema dumped in 0.41s.', '#8FBFB4');
this.setState(x => ({ sBusy: false, schema, sPos: first ? pos : x.sPos, sDumped: hm }));
this.toast('Schema dumped · ' + schema.tables.length + ' tables');
if (first) this.later(() => this.sFit(), 30);
}, 1300 * sp);
}
schemaVals() {
const s = this.state, sc = s.schema, fmt = n => n.toLocaleString('en-US');
const base = {
schemaOpen: s.schemaOpen && this.hasSchemaCmd(), closeSchema: () => this.setState({ schemaOpen: false }),
runSchema: () => this.schemaRun(), sRunLabel: s.sBusy ? 'Dumping…' : (sc ? 'Re-run helder:schema' : 'Run helder:schema'),
openSchemaCmd: () => { this.setState({ schemaOpen: false }); this.open(this.CMD); },
schemaCanvasRef: this.schemaCanvasRef, sBgDown: ev => this.sDown(ev, null), sStop: ev => ev.stopPropagation(),
hasSchema: !!sc, noSchema: !sc, sCursor: s.sDragging === 'p' ? 'grabbing' : (sc ? 'grab' : 'default'),
slogLines: s.slog.map(l => ({ t: l.t, color: l.c })), hasSlog: s.slog.length > 0 && s.slogOpen, hideSlog: () => this.setState({ slogOpen: false }),
sQ: s.sQ, onSQ: ev => this.setState({ sQ: ev.target.value })
};
if (!sc) return { ...base, sMeta: 'no dump yet', sTables: [], sList: [], sListLabel: '', sEdgesEl: null, sHasSel: false, sTransform: 'none', sZoomPct: '100%' };
const tm = this.sTmap(), P = s.sPos, q = s.sQ.trim().toLowerCase(), match = n => !!q && n.includes(q);
const focus = s.sHover || s.sSel, colF = s.sCol;
const act = e => colF ? e.from + '.' + e.col === colF : !!focus && (e.from === focus || e.to === focus);
const active = sc.edges.filter(act), rel = new Set(); active.forEach(e => { rel.add(e.from); rel.add(e.to); }); if (focus) rel.add(focus);
const dimAll = !!(focus || colF), h = React.createElement, b = this.sBounds();
const sorted = [...sc.edges].sort((x, y) => act(x) - act(y));
const sEdgesEl = h('svg', { width: Math.max(1, b.x1 + 120), height: Math.max(1, b.y1 + 120), style: { position: 'absolute', left: 0, top: 0, overflow: 'visible', pointerEvents: 'none' } },
sorted.map(e => { const g = this.sPath(e, P, tm), on = act(e), col = on ? '#E8913A' : (dimAll || q ? '#232C39' : '#3A424C'), w = on ? 1.75 : 1.25;
return h('g', { key: e.from + '.' + e.col }, h('path', { d: g.d, fill: 'none', stroke: col, strokeWidth: w }), h('circle', { cx: g.x1, cy: g.y1, r: 3, fill: '#101720', stroke: col, strokeWidth: 1.5 }), h('circle', { cx: g.x2, cy: g.y2, r: 3, fill: col })); }));
const sTables = sc.tables.map(t => {
const n = t.name, isF = n === focus, op = dimAll ? (rel.has(n) ? 1 : 0.3) : (q ? (match(n) ? 1 : 0.3) : 1);
return { name: n, x: P[n].x, y: P[n].y, op, rows: fmt(t.rows), cursor: s.sDragging === 't' ? 'grabbing' : 'pointer',
border: isF ? '#E8913A' : s.sSel === n ? '#C4741F' : rel.has(n) ? '#6C7783' : match(n) ? '#F0B476' : '#232C39',
headBg: isF || s.sSel === n ? 'rgba(232,145,58,.10)' : '#18202B', nameColor: isF || s.sSel === n ? '#F4F5F4' : '#E4E7E6',
onDown: ev => this.sDown(ev, n), onEnter: () => { if (!s.sDragging) this.setState({ sHover: n }); }, onLeave: () => this.setState({ sHover: null, sCol: null }),
cols: t.cols.map(c => { const hl = active.some(e => (e.from === n && e.col === c.n) || (e.to === n && c.pk));
return { n: c.n, t: c.t + (c.nul ? '?' : ''), key: c.pk ? 'PK' : c.fk ? 'FK' : c.uq ? 'UQ' : '',
keyColor: hl ? '#E8913A' : c.pk ? '#F0B476' : '#828D9A', nameColor: hl ? '#F4F5F4' : (c.pk || c.fk) ? '#E4E7E6' : '#BAC0C0', bg: hl ? 'rgba(232,145,58,.10)' : 'transparent',
onEnter: c.fk ? () => { if (!s.sDragging) this.setState({ sCol: n + '.' + c.n }); } : undefined, onLeave: c.fk ? () => this.setState({ sCol: null }) : undefined }; }) };
});
const listed = sc.tables.filter(t => !q || match(t.name)).sort((x, y) => x.name.localeCompare(y.name));
const sList = listed.map(t => { const n = t.name, on = n === s.sSel, hv = n === focus;
return { name: n, rows: fmt(t.rows), bar: on ? '#E8913A' : 'transparent', bg: on ? 'rgba(232,145,58,.10)' : hv ? '#1F2834' : 'transparent', color: on || hv ? '#F4F5F4' : rel.has(n) && dimAll ? '#E4E7E6' : '#BAC0C0',
onClick: () => this.sCenter(n), onEnter: () => this.setState({ sHover: n }), onLeave: () => this.setState({ sHover: null }) }; });
const sel = s.sSel && tm[s.sSel], relRow = (table, via) => ({ table, via, onClick: () => this.sCenter(table), onEnter: () => this.setState({ sHover: table }), onLeave: () => this.setState({ sHover: null }) });
const out = sel ? sc.edges.filter(e => e.from === sel.name).map(e => relRow(e.to, e.col)) : [], inn = sel ? sc.edges.filter(e => e.to === sel.name).map(e => relRow(e.from, e.col)) : [];
return { ...base,
sMeta: 'dumped ' + s.sDumped + ' · ' + sc.tables.length + ' tables · ' + sc.edges.length + ' relations', sEdgesEl, sTables, sList,
sListLabel: q ? '[ tables ] ' + listed.length + ' of ' + sc.tables.length : '[ tables ] ' + sc.tables.length,
onSQKey: ev => { if (ev.key === 'Enter' && listed.length) this.sCenter(listed[0].name); else if (ev.key === 'Escape') { ev.stopPropagation(); this.setState({ sQ: '' }); } },
sTransform: 'translate(' + s.sView.x + 'px, ' + s.sView.y + 'px) scale(' + s.sView.k + ')', sZoomPct: Math.round(s.sView.k * 100) + '%',
sZoomIn: () => this.sZoom(1.2), sZoomOut: () => this.sZoom(1 / 1.2), sFitAll: () => this.sFit(),
sHasSel: !!sel, selName: sel ? sel.name : '', selRows: sel ? fmt(sel.rows) + ' rows' : '', selColCount: sel ? sel.cols.length : 0,
selCols: sel ? sel.cols.map(c => { const fl = [c.pk && 'PRIMARY', c.fk && 'FK → ' + c.fk + '.id', c.uq && 'UNIQUE', c.nul ? 'NULL' : 'NOT NULL'].filter(Boolean).join(' · '); return { n: c.n, t: c.t, flag: fl, flagColor: c.pk || c.fk ? '#F0B476' : '#6C7783' }; }) : [],
selOut: out, selIn: inn, selHasOut: out.length > 0, selHasIn: inn.length > 0, selNoRel: !!sel && !out.length && !inn.length,
closeSel: () => this.setState({ sSel: null }),
selPass: () => { const n = sel.name; this.setState({ schemaOpen: false }); this.passOn('@schema:' + n); },
selCopy: () => this.copy(sel.name, 'Copied table name')
};
}
// ---------- git (full screen) ----------
toggleGit() { const o = !this.state.gitOpen; this.setState({ gitOpen: o, menu: null }); if (o) this.later(() => this.gitMsgRef.current && this.gitMsgRef.current.focus(), 40); }
toggleGit() { const o = !this.state.gitOpen; this.setState({ gitOpen: o, schemaOpen: false, menu: null }); if (o) this.later(() => this.gitMsgRef.current && this.gitMsgRef.current.focus(), 40); }
glog_(cmd, out) { this.setState(s => ({ glog: [...s.glog, { t: '$ ' + cmd, c: '#F4F5F4' }, ...out.map(o => typeof o === 'string' ? { t: o, c: '#BAC0C0' } : o)].slice(-400) })); }
glogAdd(out) { this.setState(s => ({ glog: [...s.glog, ...out.map(o => typeof o === 'string' ? { t: o, c: '#BAC0C0' } : o)].slice(-400) })); }
gStage(ps, cmd) {
@@ -1353,10 +1690,12 @@ Tell me to **bouw** it, or ask about one part.`
else if (mod && k === '.') { e.preventDefault(); this.setState({ hidden: !s.hidden }); }
else if (mod && k === 'l') { e.preventDefault(); this.setState({ fluid: !s.fluid }); }
else if (mod && k === 'g') { e.preventDefault(); this.toggleGit(); }
else if (mod && k === 'd' && this.hasSchemaCmd()) { e.preventDefault(); this.toggleSchema(); }
else if (mod && ['1', '2', '3'].includes(k)) { e.preventDefault(); this.togglePanel(['explorer', 'file', 'claude'][+k - 1]); }
else if (k === 'escape') {
if (s.menu) this.setState({ menu: null }); else if (s.modal) this.setState({ modal: null });
else if (s.search.open) this.setState(st => ({ search: { ...st.search, open: false } })); else if (s.diffPath) this.setState({ diffPath: null });
else if (s.schemaOpen) this.setState(s.sSel ? { sSel: null } : { schemaOpen: false });
else if (s.gitOpen) this.setState({ gitOpen: false });
else if (s.running) this.interrupt();
} else if (k === 'enter' && s.modal && s.modal.kind === 'confirm') { e.preventDefault(); this.confirmModal(); }
@@ -1536,6 +1875,7 @@ Tell me to **bouw** it, or ask about one part.`
const brGroups = [{ label: 'local', items: s.branches.map(b => brItem(b, false)) }, { label: 'remote · origin', items: s.remotes.map(b => brItem(b, true)) }];
const gReady = stagedP.length > 0 && s.commitMsg.trim().length > 0;
return {
...this.schemaVals(),
brGroups, brNote: dirty ? '— ' + dirty + ' uncommitted ' + (dirty === 1 ? 'file' : 'files') + ' · switching locked' : 'clean · click to switch', brNoteColor: dirty ? '#F0B476' : '#828D9A',
gitOpen: s.gitOpen, closeGit: () => this.setState({ gitOpen: false }), gitPull: () => this.gPull(), gitPush: () => this.gPush(),
pullText: s.gBusy === 'pull' ? 'Pulling…' : 'Pull', pushText: s.gBusy === 'push' ? 'Pushing…' : 'Push',
@@ -1555,7 +1895,7 @@ Tell me to **bouw** it, or ask about one part.`
clearGlog: ev => { ev.stopPropagation(); this.setState({ glog: [] }); },
gBusyLabel: s.gBusy === 'push' ? '→ pushing to origin…' : (s.gBusy === 'pull' ? '→ pulling from origin…' : ''),
branch: BR, crumbDir, crumbFile: cur ? this.base(cur) : '',
panelBtns: [btn('Git' + (changed.length ? ' ' + changed.length : ''), s.gitOpen, () => this.toggleGit(), 0, '⌘G'), btn('Explorer', P.explorer, () => this.togglePanel('explorer'), 1, '⌘1'), btn('File', P.file, () => this.togglePanel('file'), 2, '⌘2'), btn('Claude', P.claude, () => this.togglePanel('claude'), 3, '⌘3')],
panelBtns: [btn('Git' + (changed.length ? ' ' + changed.length : ''), s.gitOpen, () => this.toggleGit(), 0, '⌘G'), ...(this.hasSchemaCmd() ? [btn('Schema', s.schemaOpen, () => this.toggleSchema(), 1, '⌘D')] : []), btn('Explorer', P.explorer, () => this.togglePanel('explorer'), 1, '⌘1'), btn('File', P.file, () => this.togglePanel('file'), 2, '⌘2'), btn('Claude', P.claude, () => this.togglePanel('claude'), 3, '⌘3')],
toolBtns: [
{ label: 'Search', key: '⌘F', title: 'Search the project', hasDot: false, color: '#BAC0C0', bg: 'transparent', keyColor: '#E8913A', border: 'none', onClick: () => this.openSearch() },
{ label: 'Fluid', key: '⌘L', title: 'Soft-wrap long lines', hasDot: true, dot: s.fluid ? '#E8913A' : '#3A424C', color: s.fluid ? '#F4F5F4' : '#828D9A', bg: s.fluid ? 'rgba(232,145,58,.10)' : 'transparent', keyColor: s.fluid ? '#E8913A' : '#6C7783', border: '1px solid #232C39', onClick: () => this.setState({ fluid: !s.fluid }) },
@@ -1563,7 +1903,7 @@ Tell me to **bouw** it, or ask about one part.`
{ label: s.note.trim() ? 'Note •' : 'Note', key: '⌘N', title: 'Scratch note', hasDot: false, color: '#BAC0C0', bg: 'transparent', keyColor: '#E8913A', border: '1px solid #232C39', onClick: () => this.openNote() }
],
openHelp: () => this.setState({ modal: { kind: 'help', title: 'Shortcuts', confirm: 'Close', key: 'esc', noCancel: true } }),
helpRows: [{ k: '⌘F', d: 'Search the project' }, { k: '⌘L', d: 'Soft-wrap long lines (Fluid)' }, { k: '⌘.', d: 'Show hidden files' }, { k: '⌘N', d: 'Scratch note' }, { k: '⌘G', d: 'Open or close Git (full screen)' }, { k: '⌘1–3', d: 'Toggle Explorer, File, Claude' }, { k: 'Right-click', d: 'Pass on a file, folder or selection to Claude' }, { k: 'Shift+Tab', d: 'Cycle Claude mode (in the prompt)' }, { k: '⌘↵', d: 'Commit (in the Git message field)' }, { k: 'Esc', d: 'Close overlay or interrupt Claude' }],
helpRows: [{ k: '⌘F', d: 'Search the project' }, { k: '⌘L', d: 'Soft-wrap long lines (Fluid)' }, { k: '⌘.', d: 'Show hidden files' }, { k: '⌘N', d: 'Scratch note' }, { k: '⌘G', d: 'Open or close Git (full screen)' }, { k: '⌘D', d: 'Open or close Schema (when the app has helder:schema)' }, { k: '⌘1–3', d: 'Toggle Explorer, File, Claude' }, { k: 'Right-click', d: 'Pass on a file, folder or selection to Claude' }, { k: 'Shift+Tab', d: 'Cycle Claude mode (in the prompt)' }, { k: '⌘↵', d: 'Commit (in the Git message field)' }, { k: 'Esc', d: 'Close overlay or interrupt Claude' }],
showGit: P.git, showExplorer: P.explorer, showFile: P.file, showClaude: P.claude, allHidden: !P.explorer && !P.file && !P.claude,
isClean: !changed.length, hasStaged: stagedP.length > 0, hasChanges: unstagedP.length > 0,
stagedCount: stagedP.length, changeCount: unstagedP.length,
+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.
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,8 @@
@import url("tokens/fonts.css");
@import url("tokens/colors.css");
@import url("tokens/typography.css");
@import url("tokens/spacing.css");
@import url("tokens/radius.css");
@import url("tokens/elevation.css");
@import url("tokens/motion.css");
@import url("tokens/base.css");
@@ -0,0 +1,23 @@
*,
*::before,
*::after { box-sizing: border-box; }
body {
margin: 0;
background: var(--color-stone);
color: var(--color-ink-body);
font-family: var(--font-body);
font-size: var(--text-base);
font-weight: var(--weight-body);
line-height: var(--leading-normal);
-webkit-font-smoothing: antialiased;
}
a { color: var(--color-amber-deep); text-decoration-color: var(--color-stone-rule); text-underline-offset: 3px; transition: var(--transition-color); }
a:hover { color: var(--color-ink-body); text-decoration-color: var(--color-ink-dim); }
[data-surface="slate"] a { color: var(--color-amber); }
[data-surface="slate"] a:hover { color: var(--color-neutral-1); }
::selection { background: var(--color-amber-ring); color: var(--color-ink-body); }
:focus-visible { outline: 2px solid var(--color-amber); outline-offset: 2px; }
@@ -0,0 +1,66 @@
/* Kade palette — cool stone paper, slate-ink dark punctuation, amber as the only accent. */
:root {
/* Stone — the default canvas. Cool, quarried, never white. */
--color-stone: #EFF0EE;
--color-stone-2: #E5E7E4;
--color-stone-3: #D8DBD7;
--color-stone-rule: #CDD1CD;
/* Ink ramp — text on stone. */
--color-ink-body: #171C22;
--color-ink-muted: #3A424C;
--color-ink-dim: #6B7480;
/* Slate — the sparing dark surface. One or two blocks per page. */
--color-slate: #101720;
--color-slate-2: #18202B;
--color-slate-3: #232C39;
/* Neutral ramp — text on slate. Pure white does not exist in this system. */
--color-neutral-1: #F4F5F4;
--color-neutral-2: #E4E7E6;
--color-neutral-3: #BAC0C0;
--color-neutral-4: #6C7783;
/* Amber — the single accent. Reserved for action, state and signal. */
--color-amber: #E8913A;
--color-amber-deep: #C4741F;
--color-amber-soft: #F0B476;
--color-amber-tint: rgba(232, 145, 58, 0.10);
--color-amber-ring: rgba(232, 145, 58, 0.22);
/* Semantic aliases — prefer these in component code. */
--surface-page: var(--color-stone);
--surface-card: var(--color-stone-2);
--surface-card-hover: var(--color-stone-3);
--surface-dark: var(--color-slate);
--surface-dark-card: var(--color-slate-2);
--text-body: var(--color-ink-body);
--text-muted: var(--color-ink-muted);
--text-dim: var(--color-ink-dim);
--text-accent: var(--color-amber-deep);
--text-on-accent: var(--color-ink-body);
--border-hairline: var(--color-stone-rule);
--border-strong: var(--color-ink-muted);
--action-fill: var(--color-amber);
--action-fill-hover: var(--color-amber-deep);
--focus-ring: var(--color-amber-ring);
--focus-border: var(--color-amber);
--signal-error: var(--color-amber-deep);
}
/* Slate scope — inside a dark block the ramps invert. Apply to the block, not the page. */
[data-surface="slate"] {
--surface-page: var(--color-slate);
--surface-card: var(--color-slate-2);
--surface-card-hover: var(--color-slate-3);
--text-body: var(--color-neutral-1);
--text-muted: var(--color-neutral-2);
--text-dim: var(--color-neutral-4);
--text-accent: var(--color-amber);
--border-hairline: var(--color-slate-3);
--border-strong: var(--color-neutral-3);
}
@@ -0,0 +1,8 @@
/* Elevation is carried by the stone ramp, not by shadow. Shadows exist only for layers that
cross the page plane (dropdown, modal) and for the amber focus ring. */
:root {
--shadow-none: none;
--shadow-dropdown: 0 4px 16px rgba(23, 28, 34, 0.10);
--shadow-modal: 0 16px 48px rgba(23, 28, 34, 0.18);
--ring-focus: 0 0 0 2px var(--color-amber-ring);
}
@@ -0,0 +1,10 @@
/* Kade type stack — IBM Plex Mono (display + labels) and IBM Plex Sans (body + UI).
No licensed binaries shipped with the source skills, so the families load from Google Fonts.
Replace this @import with local @font-face rules once real woff2 files are supplied. */
@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,400;0,500;0,600;0,700;1,400&family=IBM+Plex+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&display=swap");
:root {
--font-display: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
--font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
--font-body: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
@@ -0,0 +1,10 @@
/* Colour shifts only. Kade never translates, lifts, or scales on hover. */
:root {
--ease-out: cubic-bezier(0.22, 1, 0.36, 1); /* @kind other */
--duration-fast: 120ms; /* @kind other */
--duration-base: 160ms; /* @kind other */
--duration-slow: 260ms; /* @kind other */
--transition-color: color var(--duration-base) var(--ease-out),
background-color var(--duration-base) var(--ease-out),
border-color var(--duration-base) var(--ease-out);
}
@@ -0,0 +1,11 @@
/* Kade is rectangular. A rounded card is an antipattern. */
:root {
--radius-none: 0px;
--radius-sm: 2px;
--radius-md: 4px;
--radius-lg: 8px;
--radius-full: 9999px;
--border-width: 1px;
--border-width-accent: 2px;
}
@@ -0,0 +1,21 @@
/* 4px base step. Section rhythm is deliberately generous; the calm comes from air, not decoration. */
:root {
--space-1: 4px;
--space-2: 8px;
--space-3: 12px;
--space-4: 16px;
--space-5: 20px;
--space-6: 24px;
--space-8: 32px;
--space-10: 40px;
--space-12: 48px;
--space-16: 64px;
--space-20: 80px;
--space-24: 96px;
--gutter: var(--space-6);
--section-y: var(--space-24);
--section-y-tight: var(--space-16);
--container: 1140px;
--measure: 68ch;
}
@@ -0,0 +1,31 @@
/* One scale for display (Plex Mono 700) and body (Plex Sans). Line-height tightens as size grows. */
:root {
--text-2xs: 10px;
--text-xs: 11px;
--text-sm: 13px;
--text-base: 15px;
--text-md: 17px;
--text-lg: 20px;
--text-xl: 24px;
--text-2xl: 32px;
--text-4xl: 44px;
--text-6xl: 58px;
--text-7xl: 76px;
--leading-display: 1.02;
--leading-tight: 1.15;
--leading-snug: 1.3;
--leading-normal: 1.6;
--leading-loose: 1.7;
/* Plex Mono display tracking is negative; label tracking is wide. */
--tracking-display: -0.04em;
--tracking-heading: -0.02em;
--tracking-normal: 0;
--tracking-label: 0.14em;
--weight-body: 400;
--weight-medium: 500;
--weight-semibold: 600;
--weight-display: 700;
}