Files
helder/design/Helder App v2.dc.html
T
2026-11-02 10:52:38 +01:00

1634 lines
135 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="./support.js"></script>
</head>
<body>
<x-dc>
<helmet>
<title>Helder v2</title>
<link rel="stylesheet" href="_ds/blijnder-e2fd6583-1c87-4e16-bc91-117f035adbbc/tokens/fonts.css">
<link rel="stylesheet" href="_ds/blijnder-e2fd6583-1c87-4e16-bc91-117f035adbbc/tokens/colors.css">
<link rel="stylesheet" href="_ds/blijnder-e2fd6583-1c87-4e16-bc91-117f035adbbc/tokens/typography.css">
<link rel="stylesheet" href="_ds/blijnder-e2fd6583-1c87-4e16-bc91-117f035adbbc/tokens/spacing.css">
<link rel="stylesheet" href="_ds/blijnder-e2fd6583-1c87-4e16-bc91-117f035adbbc/tokens/radius.css">
<link rel="stylesheet" href="_ds/blijnder-e2fd6583-1c87-4e16-bc91-117f035adbbc/tokens/elevation.css">
<link rel="stylesheet" href="_ds/blijnder-e2fd6583-1c87-4e16-bc91-117f035adbbc/tokens/motion.css">
<link rel="stylesheet" href="_ds/blijnder-e2fd6583-1c87-4e16-bc91-117f035adbbc/tokens/base.css">
<link rel="stylesheet" href="_ds/blijnder-e2fd6583-1c87-4e16-bc91-117f035adbbc/styles.css">
<script src="https://unpkg.com/lucide@0.544.0/dist/umd/lucide.js"></script>
<script src="_ds/blijnder-e2fd6583-1c87-4e16-bc91-117f035adbbc/_ds_bundle.js"></script>
<style>
html, body { margin: 0; height: 100%; background: #101720; overflow: hidden; }
a { color: #F0B476; text-decoration: none; }
a:hover { color: #F4F5F4; }
::selection { background: rgba(232,145,58,.32); }
textarea, input { caret-color: #E8913A; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #232C39; border: 2px solid transparent; background-clip: padding-box; border-radius: 9999px; }
::-webkit-scrollbar-track { background: transparent; }
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
</style>
</helmet>
<div style="position:fixed;inset:0;display:flex;flex-direction:column;background:#101720;color:#E4E7E6;font-family:'IBM Plex Sans',sans-serif;min-width:1100px">
<!-- titlebar -->
<div style="height:44px;flex:none;background:#18202B;border-bottom:1px solid #232C39;display:flex;align-items:center;gap:16px;padding:0 14px;position:relative">
<div style="display:flex;gap:8px;flex:none">
<span style="width:12px;height:12px;border-radius:9999px;background:#E8913A"></span>
<span style="width:12px;height:12px;border-radius:9999px;background:#6C7783"></span>
<span style="width:12px;height:12px;border-radius:9999px;background:#3A424C"></span>
</div>
<div style="display:flex;align-items:baseline;gap:10px;flex:1 1 auto;min-width:0;overflow:hidden">
<span style="font:700 13px/1 'IBM Plex Mono',monospace;letter-spacing:.02em;color:#F4F5F4">helder<span style="color:#E8913A;animation:blink 1.1s steps(1,end) infinite">.</span></span>
<span style="font:400 12px/1 'IBM Plex Mono',monospace;color:#6C7783">odynt</span>
<span style="font:400 12px/1 'IBM Plex Mono',monospace;color:#6C7783">·</span>
<span style="font:500 12px/1 'IBM Plex Mono',monospace;color:#E8913A;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:0 1 auto;min-width:40px">{{ branch }}</span>
<span style="font:400 12px/1 'IBM Plex Mono',monospace;color:#6C7783;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:0 1 auto;min-width:0">{{ crumbDir }}</span>
<span style="font:600 12px/1 'IBM Plex Mono',monospace;color:#F4F5F4;white-space:nowrap;flex:none">{{ crumbFile }}</span>
</div>
<div style="flex:none;display:flex;border:1px solid #232C39;border-radius:2px;overflow:hidden">
<sc-for list="{{ panelBtns }}" as="b" hint-placeholder-count="4">
<button type="button" title="{{ b.title }}" onClick="{{ b.onClick }}" style="display:flex;align-items:center;gap:7px;padding:6px 11px;border:none;border-left:{{ b.border }};cursor:pointer;font:500 12px/1 'IBM Plex Sans',sans-serif;background:{{ b.bg }};color:{{ b.color }}" style-hover="color:#F4F5F4"><span style="width:6px;height:6px;border-radius:9999px;background:{{ b.dot }}"></span>{{ b.label }}</button>
</sc-for>
</div>
<div style="display:flex;align-items:center;gap:8px;flex:none">
<div style="display:flex;border:1px solid #232C39;border-radius:2px;overflow:hidden">
<sc-for list="{{ toolBtns }}" as="b" hint-placeholder-count="4">
<button type="button" title="{{ b.title }}" onClick="{{ b.onClick }}" style="display:flex;align-items:center;gap:7px;padding:6px 10px;white-space:nowrap;border:none;border-left:{{ b.border }};cursor:pointer;font:500 12px/1 'IBM Plex Sans',sans-serif;background:{{ b.bg }};color:{{ b.color }}" style-hover="color:#F4F5F4">
<sc-if value="{{ b.hasDot }}" hint-placeholder-val="{{ false }}"><span style="width:6px;height:6px;border-radius:9999px;background:{{ b.dot }}"></span></sc-if>
{{ b.label }}<span style="font:600 11px/1 'IBM Plex Mono',monospace;color:{{ b.keyColor }}">{{ b.key }}</span>
</button>
</sc-for>
</div>
<button type="button" title="Shortcuts" onClick="{{ openHelp }}" style="width:26px;height:26px;border:1px solid #232C39;border-radius:2px;background:transparent;display:flex;align-items:center;justify-content:center;font:600 12px/1 'IBM Plex Mono',monospace;color:#6C7783;cursor:pointer" style-hover="color:#F4F5F4;border-color:#3A424C">?</button>
</div>
</div>
<div style="flex:1;min-height:0;display:flex">
<!-- explorer -->
<sc-if value="{{ showExplorer }}" hint-placeholder-val="{{ true }}">
<div style="width:320px;flex:none;background:#18202B;border-right:1px solid #232C39;display:flex;flex-direction:column;min-height:0">
<div style="height:42px;flex:none;display:flex;align-items:center;justify-content:space-between;padding:0 12px 0 16px;border-bottom:1px solid #232C39;font:700 10px/1 'IBM Plex Mono',monospace;letter-spacing:.14em;text-transform:uppercase;color:#6C7783">
<span>explorer</span>
<span style="display:flex;align-items:center;gap:4px">
<button type="button" title="New file" onClick="{{ newRootFile }}" style="width:22px;height:22px;border:none;background:transparent;color:#828D9A;cursor:pointer;display:flex;align-items:center;justify-content:center;border-radius:2px;padding:0" style-hover="color:#F4F5F4;background:#232C39"><x-import component-from-global-scope="BlijnderKadeDesignSystem_e2fd65.Icon" name="file-plus" size="{{ 14 }}" hint-size="14px,14px"></x-import></button>
<button type="button" title="Collapse all" onClick="{{ collapseAll }}" style="width:22px;height:22px;border:none;background:transparent;color:#828D9A;cursor:pointer;display:flex;align-items:center;justify-content:center;border-radius:2px;padding:0" style-hover="color:#F4F5F4;background:#232C39"><x-import component-from-global-scope="BlijnderKadeDesignSystem_e2fd65.Icon" name="chevrons-down-up" size="{{ 14 }}" hint-size="14px,14px"></x-import></button>
<span style="padding-left:6px">odynt</span>
</span>
</div>
<div style="flex:1;min-height:0;overflow:auto;padding:6px 0 16px">
<sc-for list="{{ treeRows }}" as="r" hint-placeholder-count="24">
<div onClick="{{ r.onClick }}" onContextMenu="{{ r.onMenu }}" title="{{ r.path }}" style="height:26px;display:flex;align-items:center;gap:7px;padding-left:{{ r.pad }};padding-right:12px;cursor:pointer;background:{{ r.bg }};border-left:2px solid {{ r.bar }};color:{{ r.color }};font:{{ r.weight }} 13px/1 'IBM Plex Sans',sans-serif;white-space:nowrap" style-hover="background:#232C39">
<sc-if value="{{ r.isDir }}" hint-placeholder-val="{{ true }}">
<span style="color:{{ r.chevColor }};display:flex"><x-import component-from-global-scope="BlijnderKadeDesignSystem_e2fd65.Icon" name="{{ r.chev }}" size="{{ 13 }}" hint-size="13px,13px"></x-import></span>
<span style="color:#828D9A;display:flex"><x-import component-from-global-scope="BlijnderKadeDesignSystem_e2fd65.Icon" name="{{ r.folderIcon }}" size="{{ 15 }}" hint-size="15px,15px"></x-import></span>
</sc-if>
<sc-if value="{{ r.isFile }}" hint-placeholder-val="{{ false }}">
<span style="font:600 10px/1 'IBM Plex Mono',monospace;color:#101720;background:{{ r.badgeBg }};border-radius:2px;padding:3px 4px;min-width:16px;text-align:center">{{ r.ext }}</span>
</sc-if>
<sc-if value="{{ r.isEmpty }}" hint-placeholder-val="{{ false }}">
<span style="font:400 12px/1 'IBM Plex Sans',sans-serif;color:#6C7783">— empty</span>
</sc-if>
<span style="overflow:hidden;text-overflow:ellipsis">{{ r.name }}</span>
<span style="flex:1"></span>
<span style="font:600 10px/1 'IBM Plex Mono',monospace;color:{{ r.letterColor }}">{{ r.letter }}</span>
</div>
</sc-for>
</div>
</div>
</sc-if>
<!-- editor -->
<sc-if value="{{ showFile }}" hint-placeholder-val="{{ true }}">
<div style="flex:1 1 0;min-width:360px;display:flex;flex-direction:column;min-height:0;border-right:1px solid #232C39">
<div style="height:42px;flex:none;display:flex;align-items:center;gap:10px;padding:0 10px 0 16px;border-bottom:1px solid #232C39;background:#101720">
<span style="font:600 10px/1 'IBM Plex Mono',monospace;color:#101720;background:{{ fileBadgeBg }};border-radius:2px;padding:4px 6px">{{ fileExt }}</span>
<span title="{{ filePath }}" style="flex:1;min-width:0;font:500 13px/1 'IBM Plex Mono',monospace;color:#F4F5F4;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;direction:rtl;text-align:left">{{ filePath }}</span>
<sc-if value="{{ fileDirty }}" hint-placeholder-val="{{ false }}"><span title="Changed since last commit" style="width:7px;height:7px;border-radius:9999px;background:#F4F5F4;flex:none"></span></sc-if>
<button type="button" onClick="{{ togglePreview }}" style="flex:none;padding:7px 12px;border:1px solid #232C39;border-radius:2px;background:{{ previewBg }};color:{{ previewColor }};font:500 12px/1 'IBM Plex Sans',sans-serif;cursor:pointer;opacity:{{ previewOpacity }}" style-hover="border-color:#3A424C;color:#F4F5F4">{{ previewLabel }}</button>
<button type="button" onClick="{{ openDiffCurrent }}" style="flex:none;padding:7px 12px;border:1px solid #232C39;border-radius:2px;background:transparent;color:#BAC0C0;font:500 12px/1 'IBM Plex Sans',sans-serif;cursor:pointer;opacity:{{ diffOpacity }}" style-hover="border-color:#3A424C;color:#F4F5F4">Diff</button>
</div>
<sc-if value="{{ isEdit }}" hint-placeholder-val="{{ true }}">
<div style="flex:1;min-height:0;overflow:auto;background:#101720">
<div style="display:flex;min-height:100%;min-width:100%;width:max-content;position:relative">
<sc-if value="{{ showGutter }}" hint-placeholder-val="{{ true }}">
<div style="position:absolute;top:18px;left:0;right:0;pointer-events:none">
<sc-for list="{{ gutterRows }}" as="g" hint-placeholder-count="0">
<div style="height:{{ lineH }};background:{{ g.band }}"></div>
</sc-for>
</div>
</sc-if>
<sc-if value="{{ showGutter }}" hint-placeholder-val="{{ true }}">
<div style="flex:none;padding:18px 0 40px;position:sticky;left:0;background:#101720;z-index:2">
<sc-for list="{{ gutterRows }}" as="g" hint-placeholder-count="20">
<div style="height:{{ lineH }};display:flex;align-items:center;gap:0;background:{{ g.band }}">
<span style="width:3px;height:100%;background:{{ g.mark }}"></span>
<span style="width:46px;padding-right:14px;text-align:right;font:400 {{ fontSize }}/1 'IBM Plex Mono',monospace;color:{{ g.color }}">{{ g.n }}</span>
</div>
</sc-for>
</div>
</sc-if>
<textarea ref="{{ taRef }}" value="{{ editorText }}" onChange="{{ onEdit }}" onSelect="{{ onCaret }}" onKeyUp="{{ onCaret }}" onClick="{{ onCaret }}" onContextMenu="{{ onEditorMenu }}" spellCheck="false" wrap="{{ wrapAttr }}" style="position:relative;z-index:1;flex:1;display:block;box-sizing:border-box;field-sizing:content;min-width:{{ taMinW }};width:{{ taWidth }};height:{{ taHeight }};min-height:100%;resize:none;border:none;outline:none;background:transparent;padding:18px 40px 40px 14px;margin:0;overflow:hidden;font:400 {{ fontSize }}/{{ lineH }} 'IBM Plex Mono',monospace;color:#E4E7E6;white-space:{{ taWhite }};tab-size:4"></textarea>
</div>
</div>
</sc-if>
<sc-if value="{{ isPreview }}" hint-placeholder-val="{{ false }}">
<div style="flex:1;min-height:0;overflow:auto;background:#101720;padding:28px 36px 48px">
<div style="max-width:68ch;display:flex;flex-direction:column;gap:12px">
<sc-for list="{{ previewBlocks }}" as="b" hint-placeholder-count="6">
<div style="display:flex;gap:10px;margin-top:{{ b.mt }};font:{{ b.font }};color:{{ b.color }};text-wrap:pretty">
<sc-if value="{{ b.isBullet }}" hint-placeholder-val="{{ false }}"><span style="color:#E8913A;font-family:'IBM Plex Mono',monospace;flex:none">—</span></sc-if>
<span><sc-for list="{{ b.segs }}" as="s" hint-placeholder-count="1"><span style="color:{{ s.color }};font-weight:{{ s.weight }};font-family:{{ s.family }}">{{ s.t }}</span></sc-for></span>
</div>
</sc-for>
</div>
</div>
</sc-if>
</div>
</sc-if>
<!-- claude + terminal -->
<sc-if value="{{ showClaude }}" hint-placeholder-val="{{ true }}">
<div style="flex:1.2 1 0;min-width:420px;display:flex;flex-direction:column;min-height:0;background:#101720">
<div ref="{{ transcriptRef }}" style="flex:1;min-height:0;overflow:auto;padding:18px 24px 8px;display:flex;flex-direction:column;gap:14px;font:400 13px/1.6 'IBM Plex Mono',monospace;color:#BAC0C0">
<sc-for list="{{ claudeItems }}" as="it" hint-placeholder-count="3">
<sc-if value="{{ it.isUser }}" hint-placeholder-val="{{ false }}">
<div style="display:flex;gap:10px;background:#18202B;padding:8px 12px;color:#F4F5F4;white-space:pre-wrap;word-break:break-word"><span style="color:#828D9A;flex:none">❯</span><span>{{ it.text }}</span></div>
</sc-if>
<sc-if value="{{ it.isText }}" hint-placeholder-val="{{ true }}">
<div style="display:flex;flex-direction:column">
<sc-for list="{{ it.lines }}" as="l" hint-placeholder-count="3">
<div style="min-height:{{ l.minH }};padding-left:{{ l.pad }};text-indent:{{ l.indent }};white-space:pre-wrap;word-break:break-word"><sc-for list="{{ l.segs }}" as="s" hint-placeholder-count="1"><span style="color:{{ s.color }};font-weight:{{ s.weight }}">{{ s.t }}</span></sc-for></div>
</sc-for>
</div>
</sc-if>
<sc-if value="{{ it.isTool }}" hint-placeholder-val="{{ false }}">
<div style="display:flex;flex-direction:column;gap:2px">
<div onClick="{{ it.onClick }}" style="display:flex;gap:10px;cursor:{{ it.cursor }}"><span style="color:#E8913A">⏺</span><span><span style="color:#F4F5F4;font-weight:700">{{ it.tool }}</span><span style="color:#828D9A">(</span><span style="color:#F0B476" style-hover="text-decoration:underline">{{ it.arg }}</span><span style="color:#828D9A">)</span></span></div>
<sc-for list="{{ it.detail }}" as="d" hint-placeholder-count="1">
<div style="display:flex;gap:10px;padding-left:4px"><span style="color:#3A424C;flex:none;width:14px">{{ d.lead }}</span><span style="color:{{ d.color }};background:{{ d.bg }};white-space:pre;overflow:hidden;text-overflow:ellipsis;padding:0 6px;flex:1;min-width:0">{{ d.t }}</span></div>
</sc-for>
</div>
</sc-if>
<sc-if value="{{ it.isMeta }}" hint-placeholder-val="{{ false }}">
<div style="color:#6C7783">{{ it.text }}</div>
</sc-if>
</sc-for>
<sc-if value="{{ running }}" hint-placeholder-val="{{ false }}">
<div style="color:#E8913A">{{ spinText }}<span style="color:#6C7783"> (esc to interrupt)</span></div>
</sc-if>
</div>
<div style="flex:none;padding:0 24px">
<div style="border-top:1px solid #3A424C;border-bottom:1px solid #3A424C;display:flex;align-items:flex-start;gap:10px;padding:10px 0">
<span style="font:400 14px/1.6 'IBM Plex Mono',monospace;color:#F4F5F4">❯</span>
<textarea ref="{{ claudeRef }}" value="{{ claudeInput }}" onChange="{{ onClaudeInput }}" onKeyDown="{{ onClaudeKey }}" rows="1" placeholder="{{ claudePlaceholder }}" spellCheck="false" style="flex:1;field-sizing:content;min-height:22px;max-height:160px;resize:none;border:none;outline:none;background:transparent;padding:0;font:400 13px/1.6 'IBM Plex Mono',monospace;color:#F4F5F4"></textarea>
<button type="button" title="Send (Enter)" onClick="{{ sendClaude }}" style="flex:none;border:none;background:transparent;color:{{ sendColor }};cursor:pointer;padding:2px;display:flex" style-hover="color:#F0B476"><x-import component-from-global-scope="BlijnderKadeDesignSystem_e2fd65.Icon" name="corner-down-left" size="{{ 16 }}" hint-size="16px,16px"></x-import></button>
</div>
<div style="padding:8px 18px 12px;display:flex;flex-direction:column;gap:3px;font:400 12px/1.5 'IBM Plex Mono',monospace;color:#828D9A">
<div style="display:flex;align-items:center;gap:8px;white-space:nowrap;overflow:hidden"><span>[Opus 5.5 (1M context)]</span><span style="background:#8FBFB4;color:#101720;font-weight:700;padding:0 6px">odynt</span><span>|</span><span style="overflow:hidden;text-overflow:ellipsis">{{ branch }}</span></div>
<div style="display:flex;justify-content:space-between;gap:12px">
<button type="button" onClick="{{ cycleMode }}" style="border:none;background:transparent;padding:0;cursor:pointer;font:400 12px/1.5 'IBM Plex Mono',monospace;color:{{ modeColor }};text-align:left" style-hover="color:#F0B476">▸▸ {{ modeLabel }} <span style="color:#6C7783">(shift+tab to cycle)</span></button>
<span style="color:#6C7783">{{ contextLabel }}</span>
</div>
</div>
</div>
<sc-if value="{{ showTerminal }}" hint-placeholder-val="{{ true }}">
<div onClick="{{ focusTerm }}" style="height:230px;flex:none;border-top:1px solid #232C39;display:flex;flex-direction:column;min-height:0;cursor:text">
<div style="height:30px;flex:none;display:flex;align-items:center;justify-content:space-between;padding:0 12px 0 24px;font:700 10px/1 'IBM Plex Mono',monospace;letter-spacing:.14em;text-transform:uppercase;color:#6C7783">
<span>terminal · zsh</span>
<button type="button" title="Clear" onClick="{{ clearTerm }}" 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="eraser" size="{{ 14 }}" hint-size="14px,14px"></x-import></button>
</div>
<div ref="{{ termRef }}" style="flex:1;min-height:0;overflow:auto;padding:0 24px 12px;font:400 12px/1.55 'IBM Plex Mono',monospace;color:#BAC0C0">
<sc-for list="{{ termLines }}" as="l" hint-placeholder-count="2">
<div style="white-space:pre-wrap;word-break:break-all;color:{{ l.color }}">{{ l.t }}</div>
</sc-for>
<div style="display:flex;gap:6px;align-items:baseline"><span style="color:#8FBFB4;white-space:nowrap">{{ termPrompt }}</span><input ref="{{ termInRef }}" value="{{ termInput }}" onChange="{{ onTermInput }}" onKeyDown="{{ onTermKey }}" spellCheck="false" style="flex:1;min-width:60px;border:none;outline:none;background:transparent;padding:0;font:400 12px/1.55 'IBM Plex Mono',monospace;color:#F4F5F4"></div>
</div>
</div>
</sc-if>
</div>
</sc-if>
<sc-if value="{{ allHidden }}" hint-placeholder-val="{{ false }}">
<div style="flex:1;display:flex;align-items:center;justify-content:center;font:400 13px/1.6 'IBM Plex Sans',sans-serif;color:#6C7783">— All panels are hidden. Turn one on in the title bar.</div>
</sc-if>
</div>
<!-- status bar -->
<div style="height:28px;flex:none;background:#18202B;border-top:1px solid #232C39;display:flex;align-items:center;gap:14px;padding:0 14px;font:400 12px/1 'IBM Plex Mono',monospace;color:#828D9A;white-space:nowrap">
<span style="color:#E8913A;display:flex;align-items:center;gap:6px;overflow:hidden;text-overflow:ellipsis"><x-import component-from-global-scope="BlijnderKadeDesignSystem_e2fd65.Icon" name="git-branch" size="{{ 13 }}" hint-size="13px,13px"></x-import>{{ branch }}</span>
<span style="color:#8FBFB4">+{{ statusAdd }}</span>
<span style="color:#F0B476">−{{ statusDel }}</span>
<span>{{ statusCounts }}</span>
<span style="flex:1"></span>
<span style="overflow:hidden;text-overflow:ellipsis;max-width:520px">{{ filePath }}</span>
<span>·</span><span>Ln {{ ln }}, Col {{ col }}</span>
<span>·</span><span>UTF-8</span><span>·</span><span>LF</span><span>·</span>
<span style="color:#F4F5F4">{{ lang }}</span>
</div>
<!-- search overlay -->
<sc-if value="{{ searchOpen }}" hint-placeholder-val="{{ false }}">
<div onClick="{{ closeSearch }}" style="position:fixed;inset:0;background:rgba(16,23,32,.55);z-index:40;display:flex;justify-content:center;padding-top:48px">
<div onClick="{{ stop }}" style="width:min(1640px,calc(100vw - 120px));height:calc(100vh - 110px);background:#18202B;border:1px solid #232C39;border-radius:4px;box-shadow:0 16px 48px rgba(16,23,32,.5);display:flex;flex-direction:column;overflow:hidden">
<div style="height:60px;flex:none;display:flex;align-items:center;gap:14px;padding:0 20px;border-bottom:1px solid #232C39">
<span style="color:#828D9A;display:flex"><x-import component-from-global-scope="BlijnderKadeDesignSystem_e2fd65.Icon" name="search" size="{{ 18 }}" hint-size="18px,18px"></x-import></span>
<input ref="{{ searchRef }}" value="{{ searchQ }}" onChange="{{ onSearchQ }}" onKeyDown="{{ onSearchKey }}" placeholder="Search the project" spellCheck="false" style="flex:1;min-width:120px;border:none;outline:none;background:transparent;font:600 18px/1 'IBM Plex Sans',sans-serif;color:#F4F5F4">
<div style="display:flex;gap:4px;flex-wrap:wrap;justify-content:flex-end">
<sc-for list="{{ extChips }}" as="c" hint-placeholder-count="6">
<button type="button" onClick="{{ c.onClick }}" style="padding:4px 6px;border:1px solid {{ c.border }};border-radius:2px;background:{{ c.bg }};color:{{ c.color }};font:600 11px/1 'IBM Plex Mono',monospace;cursor:pointer">{{ c.ext }}</button>
</sc-for>
</div>
<span style="font:400 12px/1 'IBM Plex Mono',monospace;color:#828D9A;white-space:nowrap">{{ searchSummary }}</span>
</div>
<div style="flex:1;min-height:0;display:grid;grid-template-columns:300px minmax(0,1fr) 320px">
<div style="border-right:1px solid #232C39;overflow:auto;padding:16px">
<div style="display:flex;align-items:center;gap:8px;margin-bottom:10px"><span style="font:600 10px/1 'IBM Plex Mono',monospace;color:#101720;background:{{ fileBadgeBg }};border-radius:2px;padding:3px 5px">{{ fileExt }}</span><span style="font:700 11px/1 'IBM Plex Mono',monospace;letter-spacing:.14em;text-transform:uppercase;color:#828D9A;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">{{ crumbFile }}</span></div>
<sc-if value="{{ hereEmpty }}" hint-placeholder-val="{{ true }}"><div style="font:400 13px/1.6 'IBM Plex Sans',sans-serif;color:#828D9A">No matches in this file.</div></sc-if>
<sc-for list="{{ hereRows }}" as="h" hint-placeholder-count="0">
<div onClick="{{ h.onClick }}" style="display:flex;gap:10px;padding:5px 6px;cursor:pointer;font:400 12px/1.5 'IBM Plex Mono',monospace;color:#BAC0C0" style-hover="background:#232C39"><span style="color:#6C7783;flex:none;width:22px;text-align:right">{{ h.n }}</span><span style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap">{{ h.a }}<span style="background:#E8913A;color:#101720">{{ h.m }}</span>{{ h.b }}</span></div>
</sc-for>
</div>
<div style="overflow:auto;padding:16px 0">
<div style="display:flex;align-items:center;gap:10px;padding:0 20px 12px"><span style="font:700 11px/1 'IBM Plex Mono',monospace;letter-spacing:.14em;text-transform:uppercase;color:#E8913A">project</span><span style="font:700 11px/1 'IBM Plex Mono',monospace;background:#E8913A;color:#101720;padding:3px 6px;border-radius:2px">{{ projCount }}</span></div>
<sc-if value="{{ projEmpty }}" hint-placeholder-val="{{ false }}"><div style="padding:0 20px;font:400 13px/1.6 'IBM Plex Sans',sans-serif;color:#828D9A">{{ projEmptyText }}</div></sc-if>
<sc-for list="{{ projGroups }}" as="g" hint-placeholder-count="0">
<div style="padding:0 0 12px">
<div onClick="{{ g.onClick }}" style="display:flex;align-items:center;gap:10px;padding:6px 20px;cursor:pointer" style-hover="background:#1F2834"><span style="font:600 10px/1 'IBM Plex Mono',monospace;color:#101720;background:{{ g.badgeBg }};border-radius:2px;padding:3px 5px">{{ g.ext }}</span><span style="flex:1;font:400 13px/1 'IBM Plex Mono',monospace;color:#F4F5F4">{{ g.path }}</span><span style="font:400 12px/1 'IBM Plex Mono',monospace;color:#6C7783">{{ g.count }}</span></div>
<sc-for list="{{ g.lines }}" as="h" hint-placeholder-count="1">
<div onClick="{{ h.onClick }}" style="display:flex;gap:14px;padding:4px 20px;cursor:pointer;font:400 13px/1.5 'IBM Plex Mono',monospace;color:#E4E7E6;border-left:2px solid transparent" style-hover="background:#232C39;border-left-color:#E8913A"><span style="color:#6C7783;flex:none;width:40px;text-align:right">{{ h.n }}</span><span style="overflow:hidden;text-overflow:ellipsis;white-space:pre">{{ h.a }}<span style="background:#E8913A;color:#101720">{{ h.m }}</span>{{ h.b }}</span></div>
</sc-for>
</div>
</sc-for>
</div>
<div style="border-left:1px solid #232C39;overflow:auto;padding:16px 0">
<div style="padding:0 20px 10px;font:700 11px/1 'IBM Plex Mono',monospace;letter-spacing:.14em;text-transform:uppercase;color:#828D9A">files {{ fileHitCount }}</div>
<sc-for list="{{ fileHits }}" as="f" hint-placeholder-count="0">
<div onClick="{{ f.onClick }}" style="display:flex;gap:10px;align-items:flex-start;padding:6px 20px;cursor:pointer" style-hover="background:#232C39">
<span style="font:600 10px/1 'IBM Plex Mono',monospace;color:#101720;background:{{ f.badgeBg }};border-radius:2px;padding:3px 5px;margin-top:2px">{{ f.ext }}</span>
<span style="display:flex;flex-direction:column;gap:3px;min-width:0"><span style="font:500 13px/1.2 'IBM Plex Sans',sans-serif;color:#F4F5F4">{{ f.a }}<span style="color:#E8913A">{{ f.m }}</span>{{ f.b }}</span><span style="font:400 11px/1.2 'IBM Plex Mono',monospace;color:#6C7783;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">{{ f.dir }}</span></span>
</div>
</sc-for>
</div>
</div>
<div style="height:40px;flex:none;border-top:1px solid #232C39;display:flex;align-items:center;gap:22px;padding:0 20px;font:400 12px/1 'IBM Plex Mono',monospace;color:#828D9A">
<span><span style="color:#F0B476">↵</span> open first hit</span>
<span>click a line to jump</span>
<span style="flex:1"></span>
<button type="button" onClick="{{ closeSearch }}" style="border:1px solid #232C39;border-radius:2px;background:transparent;color:#BAC0C0;padding:5px 8px;font:500 11px/1 'IBM Plex Mono',monospace;cursor:pointer" style-hover="color:#F4F5F4">esc</button>
</div>
</div>
</div>
</sc-if>
<!-- diff overlay -->
<sc-if value="{{ diffOpen }}" hint-placeholder-val="{{ false }}">
<div style="position:fixed;inset:0;background:#101720;z-index:45;display:flex;flex-direction:column">
<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:600 10px/1 'IBM Plex Mono',monospace;color:#101720;background:{{ diffBadgeBg }};border-radius:2px;padding:4px 6px">{{ diffExt }}</span>
<span style="font:600 13px/1 'IBM Plex Mono',monospace;color:#F4F5F4;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">{{ diffPath }}</span>
<span style="font:700 10px/1 'IBM Plex Mono',monospace;letter-spacing:.14em;text-transform:uppercase;color:#828D9A">{{ diffStatus }}</span>
<span style="font:600 12px/1 'IBM Plex Mono',monospace;color:#8FBFB4">+{{ diffAdd }}</span>
<span style="font:600 12px/1 'IBM Plex Mono',monospace;color:#F0B476">−{{ diffDel }}</span>
<span style="flex:1"></span>
<button type="button" onClick="{{ stageDiff }}" style="display:flex;align-items:center;gap:7px;padding:6px 10px;border:1px solid #232C39;border-radius:2px;background:transparent;color:#BAC0C0;font:500 12px/1 'IBM Plex Sans',sans-serif;cursor:pointer" style-hover="color:#F4F5F4;border-color:#3A424C">{{ diffStageLabel }}</button>
<button type="button" onClick="{{ discardDiff }}" style="display:flex;align-items:center;gap:7px;padding:6px 10px;border:1px solid #232C39;border-radius:2px;background:transparent;color:#F0B476;font:500 12px/1 'IBM Plex Sans',sans-serif;cursor:pointer" style-hover="border-color:#3A424C">Discard</button>
<button type="button" onClick="{{ closeDiff }}" style="display:flex;align-items:center;gap:7px;padding:6px 10px;border:1px solid #232C39;border-radius:2px;background:transparent;color:#BAC0C0;font:500 12px/1 'IBM Plex Sans',sans-serif;cursor:pointer" 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>Collapse<span style="font:600 11px/1 'IBM Plex Mono',monospace;color:#E8913A">Esc</span></button>
</div>
<div style="height:36px;flex:none;display:grid;grid-template-columns:1fr 1fr;border-bottom:1px solid #232C39;font:700 10px/1 'IBM Plex Mono',monospace;letter-spacing:.14em;text-transform:uppercase">
<div style="display:flex;align-items:center;gap:10px;padding:0 20px;color:#828D9A;border-right:1px solid #232C39">original<span style="font-weight:400;letter-spacing:0;text-transform:none;color:#6C7783">last commit</span></div>
<div style="display:flex;align-items:center;gap:10px;padding:0 20px;color:#E8913A">actual<span style="font-weight:400;letter-spacing:0;text-transform:none;color:#6C7783">working tree</span></div>
</div>
<div style="flex:1;min-height:0;overflow:auto;padding:12px 0 40px">
<sc-for list="{{ diffRows }}" as="r" hint-placeholder-count="12">
<div style="display:grid;grid-template-columns:1fr 1fr;font:400 13px/24px 'IBM Plex Mono',monospace">
<div style="display:flex;background:{{ r.lbg }};border-right:1px solid #232C39;border-left:3px solid {{ r.lbar }};min-width:0"><span style="width:44px;flex:none;text-align:right;padding-right:14px;color:{{ r.lnc }}">{{ r.ln }}</span><span style="white-space:pre-wrap;word-break:break-word;color:#E4E7E6;padding-right:16px;min-width:0">{{ r.lt }}</span></div>
<div style="display:flex;background:{{ r.rbg }};border-left:3px solid {{ r.rbar }};min-width:0"><span style="width:44px;flex:none;text-align:right;padding-right:14px;color:{{ r.rnc }}">{{ r.rn }}</span><span style="white-space:pre-wrap;word-break:break-word;color:#E4E7E6;padding-right:16px;min-width:0">{{ r.rt }}</span></div>
</div>
</sc-for>
<sc-if value="{{ diffSame }}" hint-placeholder-val="{{ false }}"><div style="padding:20px;font:400 13px/1.6 'IBM Plex Sans',sans-serif;color:#828D9A">— No changes in this file.</div></sc-if>
</div>
</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">
<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">[ git ]</span>
<span style="display:flex;align-items:center;gap:6px;font:500 12px/1 'IBM Plex Mono',monospace;color:#E8913A;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis"><x-import component-from-global-scope="BlijnderKadeDesignSystem_e2fd65.Icon" name="git-branch" size="{{ 13 }}" hint-size="13px,13px"></x-import>{{ branch }}</span>
<span style="font:400 12px/1 'IBM Plex Mono',monospace;color:#828D9A;white-space:nowrap">{{ syncLabel }}</span>
<span style="flex:1"></span>
<button type="button" onClick="{{ gitPull }}" 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="arrow-down-to-line" size="{{ 14 }}" hint-size="14px,14px"></x-import>{{ pullText }}<span style="font:600 11px/1 'IBM Plex Mono',monospace;color:#E8913A">{{ pullCount }}</span></button>
<button type="button" onClick="{{ gitPush }}" 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="arrow-up-from-line" size="{{ 14 }}" hint-size="14px,14px"></x-import>{{ pushText }}<span style="font:600 11px/1 'IBM Plex Mono',monospace;color:#E8913A">{{ pushCount }}</span></button>
<button type="button" onClick="{{ closeGit }}" 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">⌘G</span></button>
</div>
<div style="flex:none;background:#18202B;border-bottom:1px solid #232C39;display:flex;flex-direction:column">
<textarea ref="{{ gitMsgRef }}" value="{{ commitMsg }}" onChange="{{ onGitMsg }}" onKeyDown="{{ onGitMsgKey }}" placeholder="Commit message" spellCheck="false" style="field-sizing:content;min-height:56px;max-height:180px;box-sizing:border-box;resize:none;border:none;border-bottom:1px solid #232C39;outline:none;background:#101720;padding:14px 16px;font:400 14px/1.6 'IBM Plex Mono',monospace;color:#F4F5F4" style-focus="border-bottom-color:#E8913A"></textarea>
<div style="height:52px;display:flex;align-items:center;gap:16px;padding:0 14px 0 16px">
<span style="font:400 12px/1 'IBM Plex Mono',monospace;color:#828D9A;white-space:nowrap">Jonathan van Rij &lt;jonathan@blijnder.nl&gt;</span>
<span style="font:400 12px/1 'IBM Plex Mono',monospace;color:#6C7783;white-space:nowrap">⌘↵ commits</span>
<span style="flex:1"></span>
<div style="display:flex;border-radius:2px;overflow:hidden;flex:none">
<button type="button" onClick="{{ gitCommit }}" style="height:32px;min-width:160px;padding:0 18px;border:none;background:{{ gCommitBg }};color:{{ gCommitColor }};font:600 13px/1 'IBM Plex Sans',sans-serif;cursor:pointer" style-hover="filter:brightness(0.92)">{{ gCommitLabel }}</button>
<button type="button" title="More commit options" onClick="{{ gitCommitMenu }}" style="width:32px;height:32px;border:none;border-left:1px solid #101720;background:{{ gCommitBg }};color:{{ gCommitColor }};cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0" style-hover="filter:brightness(0.92)"><x-import component-from-global-scope="BlijnderKadeDesignSystem_e2fd65.Icon" name="chevron-down" size="{{ 14 }}" hint-size="14px,14px"></x-import></button>
</div>
</div>
</div>
<div style="flex:1;min-height:0;overflow:auto;padding-bottom:24px">
<sc-if value="{{ gitClean }}" hint-placeholder-val="{{ false }}">
<div style="padding:24px 16px;font:400 13px/1.6 'IBM Plex Sans',sans-serif;color:#828D9A">— No changes. The working tree is clean.</div>
</sc-if>
<sc-for list="{{ gitSections }}" as="sec" hint-placeholder-count="3">
<div style="display:flex;flex-direction:column;margin-top:{{ sec.mt }};border-top:1px solid {{ sec.topRule }}">
<div onClick="{{ sec.onToggle }}" style="height:46px;flex:none;display:flex;align-items:center;gap:10px;padding:0 14px 0 11px;cursor:pointer;border-bottom:1px solid #232C39;border-left:3px solid {{ sec.color }};background:{{ sec.tint }}" style-hover="background:#18202B">
<span style="display:flex;color:{{ sec.chevColor }}"><x-import component-from-global-scope="BlijnderKadeDesignSystem_e2fd65.Icon" name="{{ sec.chev }}" size="{{ 14 }}" hint-size="14px,14px"></x-import></span>
<span style="font:700 11px/1 'IBM Plex Mono',monospace;letter-spacing:.14em;text-transform:uppercase;color:{{ sec.color }};white-space:nowrap">{{ sec.label }}</span>
<span style="font:600 11px/1 'IBM Plex Mono',monospace;color:#101720;background:{{ sec.countBg }};border-radius:2px;padding:3px 6px">{{ sec.count }}</span>
<span style="flex:1"></span>
<div style="display:grid;grid-template-columns:100px 100px;gap:6px;flex:none">
<sc-for list="{{ sec.actions }}" as="ac" hint-placeholder-count="2">
<sc-if value="{{ ac.isGap }}" hint-placeholder-val="{{ false }}"><span></span></sc-if>
<sc-if value="{{ ac.isBtn }}" hint-placeholder-val="{{ true }}"><button type="button" onClick="{{ ac.onClick }}" style="width:100px;height:28px;border:1px solid #3A424C;border-radius:2px;background:transparent;color:{{ ac.color }};font:500 12px/1 'IBM Plex Sans',sans-serif;cursor:pointer" style-hover="border-color:#6C7783;background:#232C39">{{ ac.label }}</button></sc-if>
</sc-for>
</div>
</div>
<sc-if value="{{ sec.open }}" hint-placeholder-val="{{ true }}">
<sc-for list="{{ sec.files }}" as="f" hint-placeholder-count="3">
<div style="display:flex;flex-direction:column;border-bottom:1px solid #232C39">
<div onClick="{{ f.onToggle }}" onContextMenu="{{ f.onMenu }}" style="height:36px;display:flex;align-items:center;gap:10px;padding:0 14px 0 11px;cursor:pointer;background:{{ f.bg }};border-left:3px solid {{ f.bar }}" style-hover="background:#1F2834">
<span style="display:flex;color:{{ f.chevColor }}"><x-import component-from-global-scope="BlijnderKadeDesignSystem_e2fd65.Icon" name="{{ f.chev }}" size="{{ 13 }}" hint-size="13px,13px"></x-import></span>
<span title="{{ f.statusName }}" style="width:18px;height:18px;flex:none;display:flex;align-items:center;justify-content:center;border-radius:2px;background:{{ f.letterColor }};font:700 11px/1 'IBM Plex Mono',monospace;color:#101720">{{ f.letter }}</span>
<span style="flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:400 13px/1 'IBM Plex Mono',monospace;text-decoration:{{ f.deco }}"><span style="color:#828D9A">{{ f.dir }}</span><span style="color:{{ f.nameColor }}">{{ f.name }}</span></span>
<span style="width:52px;flex:none;text-align:right;font:500 12px/1 'IBM Plex Mono',monospace;color:#8FBFB4;white-space:nowrap">{{ f.add }}</span>
<span style="width:52px;flex:none;text-align:right;font:500 12px/1 'IBM Plex Mono',monospace;color:#F0B476;white-space:nowrap;padding-right:8px">{{ f.del }}</span>
<div style="display:grid;grid-template-columns:100px 100px;gap:6px;flex:none">
<sc-for list="{{ f.actions }}" as="ac" hint-placeholder-count="2">
<sc-if value="{{ ac.isGap }}" hint-placeholder-val="{{ false }}"><span></span></sc-if>
<sc-if value="{{ ac.isBtn }}" hint-placeholder-val="{{ true }}"><button type="button" onClick="{{ ac.onClick }}" style="width:100px;height:26px;border:1px solid transparent;border-radius:2px;background:transparent;color:{{ ac.color }};font:500 12px/1 'IBM Plex Sans',sans-serif;cursor:pointer" style-hover="border-color:#3A424C;background:#232C39;color:#F4F5F4">{{ ac.label }}</button></sc-if>
</sc-for>
</div>
</div>
<sc-if value="{{ f.open }}" hint-placeholder-val="{{ false }}">
<div style="border-top:1px solid #232C39;padding:8px 0 12px;font:400 13px/22px 'IBM Plex Mono',monospace">
<sc-for list="{{ f.rows }}" as="r" hint-placeholder-count="8">
<sc-if value="{{ r.isSep }}" hint-placeholder-val="{{ false }}">
<div style="height:28px;display:flex;align-items:center;padding:0 16px 0 64px;margin:6px 0;background:#18202B;font:400 11px/1 'IBM Plex Mono',monospace;color:#6C7783">{{ r.label }}</div>
</sc-if>
<sc-if value="{{ r.isLine }}" hint-placeholder-val="{{ true }}">
<div style="display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr)">
<div style="display:flex;background:{{ r.lbg }};border-right:1px solid #232C39;min-width:0"><span style="width:52px;flex:none;text-align:right;padding-right:12px;color:{{ r.lnc }};user-select:none">{{ r.ln }}</span><span style="white-space:pre-wrap;word-break:break-word;color:#E4E7E6;padding-right:16px;min-width:0;tab-size:4">{{ r.la }}<span style="background:{{ r.lhl }}">{{ r.lm }}</span>{{ r.lb }}</span></div>
<div style="display:flex;background:{{ r.rbg }};min-width:0"><span style="width:52px;flex:none;text-align:right;padding-right:12px;color:{{ r.rnc }};user-select:none">{{ r.rn }}</span><span style="white-space:pre-wrap;word-break:break-word;color:#E4E7E6;padding-right:16px;min-width:0;tab-size:4">{{ r.ra }}<span style="background:{{ r.rhl }}">{{ r.rm }}</span>{{ r.rb }}</span></div>
</div>
</sc-if>
</sc-for>
</div>
</sc-if>
</div>
</sc-for>
</sc-if>
</div>
</sc-for>
</div>
<div style="height:230px;flex:none;border-top:1px solid #232C39;background:#18202B;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);min-height:0">
<div onClick="{{ focusGitIn }}" style="display:flex;flex-direction:column;min-height:0;min-width:0;cursor:text;border-right:1px solid #232C39">
<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 ] git</span>
<span style="color:#E8913A;letter-spacing:0;text-transform:none;font-weight:400;font-size:12px">{{ gBusyLabel }}</span>
<span style="flex:1"></span>
<button type="button" title="Clear" onClick="{{ clearGlog }}" 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="eraser" size="{{ 14 }}" hint-size="14px,14px"></x-import></button>
</div>
<div ref="{{ glogRef }}" style="flex:1;min-height:0;overflow:auto;padding:0 16px 12px;font:400 12px/1.6 'IBM Plex Mono',monospace;color:#BAC0C0">
<sc-for list="{{ glogLines }}" as="l" hint-placeholder-count="3">
<div style="white-space:pre-wrap;word-break:break-all;tab-size:4;color:{{ l.color }}">{{ l.t }}</div>
</sc-for>
<div style="display:flex;gap:8px;align-items:baseline"><span style="color:#8FBFB4;white-space:nowrap">$ git</span><input ref="{{ gitInRef }}" value="{{ gInput }}" onChange="{{ onGInput }}" onKeyDown="{{ onGKey }}" placeholder="status · add -A · commit -m &quot;…&quot; · push · pull · log" spellCheck="false" style="flex:1;min-width:60px;border:none;outline:none;background:transparent;padding:0;font:400 12px/1.6 'IBM Plex Mono',monospace;color:#F4F5F4"></div>
</div>
</div>
<div style="display:flex;flex-direction:column;min-height:0;min-width:0">
<div style="height:32px;flex:none;display:flex;align-items:center;gap:12px;padding:0 16px;font:700 10px/1 'IBM Plex Mono',monospace;letter-spacing:.14em;text-transform:uppercase;color:#6C7783">
<span>[ branches ]</span>
<span style="flex:1"></span>
<span style="letter-spacing:0;text-transform:none;font-weight:400;font-size:12px;color:{{ brNoteColor }}">{{ brNote }}</span>
</div>
<div style="flex:1;min-height:0;overflow:auto;padding:0 0 12px">
<sc-for list="{{ brGroups }}" as="g" hint-placeholder-count="2">
<div style="padding:8px 16px 4px;font:700 10px/1 'IBM Plex Mono',monospace;letter-spacing:.14em;text-transform:uppercase;color:#6C7783">{{ g.label }}</div>
<sc-for list="{{ g.items }}" as="b" hint-placeholder-count="3">
<div onClick="{{ b.onClick }}" title="{{ b.title }}" style="height:28px;display:flex;align-items:center;gap:10px;padding:0 16px 0 13px;border-left:3px solid {{ b.bar }};cursor:{{ b.cursor }};opacity:{{ b.opacity }};background:{{ b.bg }}" style-hover="background:#232C39">
<span style="display:flex;color:{{ b.iconColor }}"><x-import component-from-global-scope="BlijnderKadeDesignSystem_e2fd65.Icon" name="{{ b.icon }}" size="{{ 13 }}" hint-size="13px,13px"></x-import></span>
<span style="flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:{{ b.weight }} 12px/1 'IBM Plex Mono',monospace;color:{{ b.color }}">{{ b.name }}</span>
<span style="font:400 11px/1 'IBM Plex Mono',monospace;color:#6C7783;white-space:nowrap">{{ b.meta }}</span>
<span style="font:600 11px/1 'IBM Plex Mono',monospace;color:#E8913A;white-space:nowrap">{{ b.action }}</span>
</div>
</sc-for>
</sc-for>
</div>
</div>
</div>
</div>
</sc-if>
<!-- context menu -->
<sc-if value="{{ menuOpen }}" hint-placeholder-val="{{ false }}">
<div onClick="{{ closeMenu }}" onContextMenu="{{ closeMenuCtx }}" style="position:fixed;inset:0;z-index:60"></div>
<div style="position:fixed;left:{{ menuX }};top:{{ menuY }};z-index:61;width:300px;background:#18202B;border:1px solid #2B3544;border-radius:4px;box-shadow:0 4px 16px rgba(16,23,32,.45);padding:6px 0;font:400 14px/1 'IBM Plex Sans',sans-serif">
<sc-if value="{{ menuHasTitle }}" hint-placeholder-val="{{ false }}"><div style="padding:6px 16px 10px;font:400 12px/1.3 'IBM Plex Mono',monospace;color:#828D9A;border-bottom:1px solid #232C39;margin-bottom:6px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">{{ menuTitle }}</div></sc-if>
<sc-for list="{{ menuItems }}" as="m" hint-placeholder-count="4">
<sc-if value="{{ m.sep }}" hint-placeholder-val="{{ false }}"><div style="height:1px;background:#232C39;margin:6px 0"></div></sc-if>
<button type="button" onClick="{{ m.onClick }}" style="width:100%;display:flex;align-items:center;gap:12px;padding:9px 16px 9px 14px;border:none;border-left:2px solid transparent;background:transparent;color:{{ m.color }};font:{{ m.weight }} 14px/1 'IBM Plex Sans',sans-serif;cursor:pointer;text-align:left" style-hover="background:#232C39;border-left-color:#E8913A"><span style="display:flex;color:{{ m.iconColor }}"><x-import component-from-global-scope="BlijnderKadeDesignSystem_e2fd65.Icon" name="{{ m.icon }}" size="{{ 16 }}" hint-size="16px,16px"></x-import></span>{{ m.label }}</button>
</sc-for>
</div>
</sc-if>
<!-- modal -->
<sc-if value="{{ modalOpen }}" hint-placeholder-val="{{ false }}">
<div onClick="{{ modalCancel }}" style="position:fixed;inset:0;z-index:70;background:rgba(16,23,32,.6);display:flex;align-items:flex-start;justify-content:center;padding-top:120px">
<div onClick="{{ stop }}" style="width:min(560px,calc(100vw - 48px));background:#18202B;border:1px solid #2B3544;border-radius:8px;box-shadow:0 16px 48px rgba(16,23,32,.5);padding:24px;display:flex;flex-direction:column;gap:14px">
<div style="font:700 17px/1.35 'IBM Plex Mono',monospace;letter-spacing:-.01em;color:#F4F5F4;word-break:break-word">{{ modalTitle }}</div>
<sc-if value="{{ modalHasBody }}" hint-placeholder-val="{{ false }}"><div style="font:400 13px/1.6 'IBM Plex Mono',monospace;color:#828D9A;white-space:pre-line">{{ modalBody }}</div></sc-if>
<sc-if value="{{ isPrompt }}" hint-placeholder-val="{{ false }}">
<input ref="{{ modalInRef }}" value="{{ modalInput }}" onChange="{{ onModalInput }}" onKeyDown="{{ onModalKey }}" spellCheck="false" style="height:38px;box-sizing:border-box;border:1px solid #3A424C;border-radius:2px;background:#101720;padding:0 12px;outline:none;font:400 14px/1 'IBM Plex Mono',monospace;color:#F4F5F4" style-focus="border:2px solid #E8913A;padding:0 11px">
</sc-if>
<sc-if value="{{ isNote }}" hint-placeholder-val="{{ false }}">
<textarea ref="{{ modalInRef }}" value="{{ modalInput }}" onChange="{{ onModalInput }}" onKeyDown="{{ onModalKey }}" placeholder="A note to yourself. ⌘↵ saves." style="height:160px;resize:none;box-sizing:border-box;border:1px solid #3A424C;border-radius:2px;background:#101720;padding:10px 12px;outline:none;font:400 13px/1.6 'IBM Plex Sans',sans-serif;color:#F4F5F4" style-focus="border:2px solid #E8913A;padding:9px 11px"></textarea>
</sc-if>
<sc-if value="{{ isHelp }}" hint-placeholder-val="{{ false }}">
<div style="display:grid;grid-template-columns:auto 1fr;gap:8px 20px;font:400 13px/1.4 'IBM Plex Sans',sans-serif;color:#BAC0C0">
<sc-for list="{{ helpRows }}" as="h" hint-placeholder-count="6"><span style="font:600 12px/1.4 'IBM Plex Mono',monospace;color:#E8913A">{{ h.k }}</span><span>{{ h.d }}</span></sc-for>
</div>
</sc-if>
<div style="display:flex;justify-content:flex-end;gap:10px;padding-top:6px">
<sc-if value="{{ modalHasCancel }}" hint-placeholder-val="{{ true }}">
<button type="button" onClick="{{ modalCancel }}" style="display:flex;align-items:center;gap:12px;height:38px;padding:0 14px;border:1px solid #3A424C;border-radius:2px;background:transparent;color:#BAC0C0;font:600 14px/1 'IBM Plex Sans',sans-serif;cursor:pointer" style-hover="color:#F4F5F4;border-color:#6C7783">Cancel<span style="font:600 12px/1 'IBM Plex Mono',monospace;color:#E8913A;border:1px solid #3A424C;border-radius:2px;padding:4px 6px">esc</span></button>
</sc-if>
<button type="button" onClick="{{ modalConfirm }}" style="display:flex;align-items:center;gap:12px;height:38px;padding:0 14px;border:none;border-radius:2px;background:#E8913A;color:#101720;font:600 14px/1 'IBM Plex Sans',sans-serif;cursor:pointer" style-hover="background:#C4741F">{{ modalConfirmLabel }}<span style="font:600 12px/1 'IBM Plex Mono',monospace;border:1px solid rgba(16,23,32,.35);border-radius:2px;padding:3px 6px">{{ modalConfirmKey }}</span></button>
</div>
</div>
</div>
</sc-if>
<!-- toast -->
<sc-if value="{{ toastOpen }}" hint-placeholder-val="{{ false }}">
<div style="position:fixed;left:50%;bottom:44px;transform:translateX(-50%);z-index:80;background:#232C39;border:1px solid #3A424C;border-radius:2px;padding:10px 16px;font:400 13px/1.4 'IBM Plex Mono',monospace;color:#F4F5F4;box-shadow:0 4px 16px rgba(16,23,32,.45);max-width:70vw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap"><span style="color:#E8913A">→ </span>{{ toastText }}</div>
</sc-if>
</div>
</x-dc>
<script type="text/x-dc" data-dc-script data-props="{&quot;claudeSpeed&quot;:{&quot;editor&quot;:&quot;enum&quot;,&quot;options&quot;:[&quot;slow&quot;,&quot;normal&quot;,&quot;fast&quot;],&quot;default&quot;:&quot;normal&quot;,&quot;tsType&quot;:&quot;'slow'|'normal'|'fast'&quot;,&quot;section&quot;:&quot;Claude&quot;},&quot;showTerminal&quot;:{&quot;editor&quot;:&quot;boolean&quot;,&quot;default&quot;:true,&quot;tsType&quot;:&quot;boolean&quot;,&quot;section&quot;:&quot;Layout&quot;},&quot;fontSize&quot;:{&quot;editor&quot;:&quot;range&quot;,&quot;min&quot;:12,&quot;max&quot;:18,&quot;step&quot;:1,&quot;unit&quot;:&quot;px&quot;,&quot;default&quot;:14,&quot;tsType&quot;:&quot;number&quot;,&quot;section&quot;:&quot;Editor&quot;}}">
class Component extends DCLogic {
taRef = React.createRef(); gitMsgRef = React.createRef(); gitInRef = React.createRef(); glogRef = React.createRef(); claudeRef = React.createRef(); transcriptRef = React.createRef();
termRef = React.createRef(); termInRef = React.createRef(); searchRef = React.createRef(); modalInRef = React.createRef();
runId = 0; done = {}; timers = [];
state = this.initial();
// ---------- data ----------
initial() {
const BR = 'ontwikkeling/2026-10-06-001-one-user-mcp-connection';
const F = {};
const put = (p, c) => { F[p] = { orig: c, content: c }; };
const mod = (p, o, c) => { F[p] = { orig: o, content: c }; };
const add = (p, c) => { F[p] = { orig: null, content: c }; };
const D = 'ontwikkelingen/';
const intentO = `# Raw intent: compression caching toggles
Source: darwin, 2026-10-09. Not grilled.
Let's change the compression- and caching-related settings and behavior on the agent chats.
The goal would be to have a toggle to enable or disable compression and a toggle to enable or disable caching, but only when one of these techniques is compatible with the selected model.
When compression is enabled, the user can select a type of compression. I imagine the options might include compression for short conversations, a general compression setting, or a setting focused on very long conversations with lots of data. These presets should then set the correct values for each model.
I think these values should be defined where the models are also defined in the config. This is my raw description of the feature. So, for now, create a raw ontwikkeling.`;
const intentC = intentO + `
## Additions from odynt#112 (Bob, 2026-10-09, on Jonathan's request)
Raw input for the grilling, not grilled. Source: the prompt-caching research on odynt#112.
- **Cache the history, not only the system prompt.** Today the cache covers tools and the system prompt. The history is sent fresh every turn.
- **Store \`input_tokens\` and \`output_tokens\` per message.** The \`messages\` table keeps only the cache read and write counts.
- **Caching and compression work against each other.** Each compaction rewrites the history, so the cache breaks on the next turn.
- **The minimum cache size differs per model:** 512 tokens on the 5.x models, 4096 on Haiku 4.5. It belongs in the model config.`;
mod(D + '001-compression-caching-toggles-2026-10-09/intent-raw.md', intentO, intentC);
const agentO = `<?php
namespace App\\Models;
use Illuminate\\Database\\Eloquent\\Model;
class Agent extends Model
{
protected $fillable = [
'name',
'model',
'system_prompt',
];
public function vaults()
{
return $this->belongsToMany(Vault::class);
}
}`;
const agentC = agentO.replace(` 'system_prompt',
];`, ` 'system_prompt',
'vault_usage_scope',
];
protected $casts = [
'vault_usage_scope' => VaultUsageScope::class,
];`);
mod('app/Models/Agent.php', agentO, agentC);
const vcO = `<?php
namespace App\\Http\\Controllers;
use App\\Models\\Vault;
use Illuminate\\Http\\Request;
class VaultController extends Controller
{
public function index()
{
return view('vaults.index', [
'vaults' => Vault::latest()->paginate(20),
]);
}
public function create()
{
return view('vaults.create');
}
public function store(Request $request)
{
$data = $request->validate([
'name' => ['required', 'string', 'max:120'],
'description' => ['nullable', 'string'],
]);
$vault = Vault::create($data);
return redirect()->route('vaults.show', $vault);
}
public function show(Vault $vault)
{
return view('vaults.show', compact('vault'));
}
}`;
const vcC = vcO
.replace("Vault::latest()->paginate(20)", "Vault::withCount('documents')->latest()->paginate(25)")
.replace(" 'description' => ['nullable', 'string'],", " 'description' => ['nullable', 'string'],\n 'accessible_by_mcp' => ['boolean'],")
.replace("return redirect()->route('vaults.show', $vault);", "return redirect()->route('vaults.show', $vault)->with('status', 'Vault created.');");
mod('app/Http/Controllers/VaultController.php', vcO, vcC);
add('database/migrations/2026_10_09_000001_add_token_columns_to_messages.php', `<?php
use Illuminate\\Database\\Migrations\\Migration;
use Illuminate\\Database\\Schema\\Blueprint;
use Illuminate\\Support\\Facades\\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('messages', function (Blueprint $table) {
$table->unsignedInteger('input_tokens')->nullable();
$table->unsignedInteger('output_tokens')->nullable();
});
}
};`);
put('app/Providers/AppServiceProvider.php', `<?php
namespace App\\Providers;
use Illuminate\\Support\\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
public function register(): void
{
//
}
public function boot(): void
{
//
}
}`);
put('app/Ai/ChatAgent.php', `<?php
namespace App\\Ai;
use App\\Models\\Agent;
use App\\Registries\\ModelRegistry;
class ChatAgent
{
public function __construct(
private Agent $agent,
private ModelRegistry $models,
) {}
public function cacheControl(): array
{
// Tools and system prompt only. History is sent fresh every turn.
return ['type' => 'ephemeral'];
}
}`);
put('app/Mcp/Tools/AgentSearch.php', `<?php
namespace App\\Mcp\\Tools;
class AgentSearch
{
public function name(): string
{
return 'vault_search';
}
}`);
put('bootstrap/providers.php', `<?php
return [
App\\Providers\\AppServiceProvider::class,
App\\Providers\\HorizonServiceProvider::class,
];`);
put('config/ai.php', this.configO());
put('config/app.php', `<?php
return [
'name' => env('APP_NAME', 'Odynt'),
'env' => env('APP_ENV', 'production'),
'url' => env('APP_URL', 'https://odynt.test'),
'locale' => 'nl',
];`);
put('config/filesystems.php', `<?php
return [
'default' => env('FILESYSTEM_DISK', 'local'),
// flagged 'flows' => true here; see App\\Flows\\Support\\FlowDiskGuard.
];`);
put('cypress/e2e/Flow/FlowList.cy.js', `describe('Flow list', () => {
it('shows runs per flow', () => {
cy.visit('/admin/flows');
cy.contains('Alpha').parent().should('contain', '3 runs');
});
});`);
put('docs/architecture.md', `# Architecture
- **Agents** live in \`app/Models/Agent.php\` and talk to models through \`App\\Ai\\ChatAgent\`.
- **Vaults** hold the knowledge an agent may search.
- **Flows** chain agents into a run.
Models and their limits are defined in \`config/ai.php\`.`);
put('lang/nl/auth.php', `<?php
return [
'failed' => 'Deze gegevens kloppen niet.',
];`);
put(D + '2026-10-06-001-one-user-mcp-connection/intent-raw.md', `# Raw intent: one-user MCP connection
Source: Jonathan, 2026-10-06.
One user connects one MCP client to their Vaults with a personal key. The key shows one time. A second key is refused.`);
put(D + '2026-10-06-001-one-user-mcp-connection/deliver.md', `# Deliver: one-user MCP connection
- Settings page: make a key, revoke it, see it one time.
- Agent form: "Vault usage scope" defaults to None.
- Vault form: "Accessible by MCP" is off by default.
Test at https://odynt.test/admin/vaults/create`);
put(D + '2026-10-09-001-flow-connector-management/intent-raw.md', `# Raw intent: flow connector management
Source: Jonathan, 2026-10-09. Not grilled.
Manage the connectors a flow may use from one screen, instead of per node.`);
put(D + '2026-10-09-002-rename-flow-to-flow-configuration/intent-raw.md', `# Raw intent: rename flow to flow configuration
Source: Jonathan, 2026-10-09. Not grilled.
"Flow" means two things today: the definition and the run. Rename the definition to "flow configuration".`);
put('public/index.php', `<?php
use Illuminate\\Foundation\\Application;
/** @var Application $app */
$app = require_once __DIR__.'/../bootstrap/app.php';
$app->handleRequest(Illuminate\\Http\\Request::capture());`);
put('resources/js/app.js', `import './bootstrap';
import Alpine from 'alpinejs';
window.Alpine = Alpine;
Alpine.start();`);
put('resources/css/app.css', `@import 'tailwindcss';
:root {
--stone: #EFF0EE;
--amber: #E8913A;
}`);
put('routes/web.php', `<?php
use Illuminate\\Support\\Facades\\Route;
Route::get('/', fn () => view('welcome'));
Route::middleware('auth')->prefix('admin')->group(function () {
Route::resource('vaults', VaultController::class);
Route::resource('agents', AgentController::class);
});`);
put('tests/Feature/AppDataTest.php', `<?php
namespace Tests\\Feature;
use Tests\\TestCase;
class AppDataTest extends TestCase
{
public function test_app_data_loads(): void
{
$this->get('/')->assertOk();
}
}`);
put('AGENTS.md', `# Agents
Read CLAUDE.md first. Work happens in \`ontwikkelingen/\`: one folder per change, raw intent first, then grilled, then built.`);
put('artisan', `#!/usr/bin/env php
<?php
define('LARAVEL_START', microtime(true));
$status = (require_once __DIR__.'/bootstrap/app.php')->handleCommand(new ArgvInput);
exit($status);`);
put('boost.json', `{
"agents": ["claude_code"],
"guidelines": true
}`);
put('CLAUDE.md', `# Odynt
- Laravel 12, PHP 8.4, Alpine, Tailwind.
- Run \`php artisan test\` before you report done.
- Never run \`migrate:fresh\` directly. Use menu › Reset & Seed.`);
put('composer.json', `{
"name": "blijnder/odynt",
"require": {
"php": "^8.4",
"laravel/framework": "^12.0"
},
"autoload": {
"psr-4": {
"App\\\\": "app/"
}
}
}`);
put('package.json', `{
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build"
}
}`);
put('phpunit.xml', `<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php" colors="true">
<testsuites>
<testsuite name="Feature">
<directory>tests/Feature</directory>
</testsuite>
</testsuites>
</phpunit>`);
put('README.md', `# Odynt
Expertise infrastructure for independent experts.
Run \`composer run dev\` and open https://odynt.test.`);
put('vite.config.js', `import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
export default defineConfig({
plugins: [laravel(['resources/css/app.css', 'resources/js/app.js'])],
});`);
put('.env', `APP_NAME=Odynt
APP_ENV=local
APP_URL=https://odynt.test
AI_MODEL=claude-opus-5-5`);
put('.gitignore', `/vendor
/node_modules
.env`);
put('.claude/settings.json', `{
"permissions": { "deny": ["Bash(php artisan migrate:fresh)"] }
}`);
F['app/Http/Controllers/LegacyMcpTokenController.php'] = { orig: ['<?php', '', 'namespace App\\Http\\Controllers;', '', 'use Illuminate\\Http\\Request;', '', 'class LegacyMcpTokenController extends Controller', '{', ' public function store(Request $request)', ' {', " $token = $request->user()->createToken('mcp');", '', " return response()->json(['token' => $token->plainTextToken]);", ' }', '}'].join('\n'), content: null };
const intent = D + '001-compression-caching-toggles-2026-10-09/intent-raw.md';
return {
BR, files: F,
emptyDirs: ['blueprints', 'designs', 'screenshots', 'storage', 'stubs', 'temp'],
staged: ['app/Models/Agent.php'],
expanded: ['app', 'app/Http', 'app/Http/Controllers', 'app/Models', 'database', 'database/migrations', 'ontwikkelingen', 'ontwikkelingen/001-compression-caching-toggles-2026-10-09'],
current: intent, selected: intent, view: 'edit',
panels: { git: true, explorer: true, file: true, claude: true },
fluid: false, hidden: false,
menu: null, modal: null, toast: null,
search: { open: false, q: '', exts: [] }, diffPath: null,
ln: 1, col: 1,
entries: this.seedTranscript(), claudeInput: '', running: false, verb: 'Thinking', spin: 0, mode: 0,
term: [
{ t: 'php artisan app:reset --seed', c: '#BAC0C0', p: true },
{ t: 'Environment reset and seeded successfully.', c: '#8FBFB4' }
], termInput: '', history: [],
commits: [], ahead: 0, commitMsg: '', note: '',
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' }]
};
}
configO() {
return `<?php
return [
'default' => env('AI_MODEL', 'claude-opus-5-5'),
'models' => [
'claude-opus-5-5' => [
'label' => 'Opus 5.5',
'context' => 1_000_000,
],
'claude-sonnet-5' => [
'label' => 'Sonnet 5',
'context' => 400_000,
],
'claude-haiku-4-5' => [
'label' => 'Haiku 4.5',
'context' => 200_000,
],
],
];`;
}
seedTranscript() {
return [
{ kind: 'user', text: 'Test the one-user MCP connection end to end and report what you found.' },
{ kind: 'tool', tool: 'Bash', arg: 'php artisan app:reset --seed', detail: [{ t: 'Environment reset and seeded successfully.', c: '#8FBFB4' }] },
{ kind: 'text', text: `The key kept working.
**UI**
- **Settings page:** making a key shows it one time; after a reload the key is hidden. A second key is refused. Revoking works.
- **Agent form:** "Vault usage scope" defaults to None.
- **Vault form:** "Accessible by MCP" is off by default.
**Points to look at**
1. **deliver.md has a wrong link:** \`/crud/vaults/create\` returns 404. The form is at \`/admin/vaults/create\`.
2. **Log noise:** every bad or revoked token writes a \`local.ERROR\` with a stack trace.
3. **Wrong scheme in the seed output:** it prints \`http://odynt.test/mcp\`, but the site runs on https.
**Not tested here:** the throttles (R7) and the release migration (R28). They need live AI calls.` },
{ kind: 'meta', text: '✻ Baked for 10m 5s · done 12:50 PM' }
];
}
// ---------- helpers ----------
later(fn, ms) { const id = setTimeout(fn, ms); this.timers.push(id); return id; }
lines(s) { return s == null ? [] : s.split('\n'); }
ext(p) { const n = p.split('/').pop(); if (n.startsWith('.') && n.indexOf('.', 1) < 0) return 'env'; const i = n.lastIndexOf('.'); return i > 0 ? n.slice(i + 1) : '·'; }
badge(e) { return ({ php: '#C3A6CE', md: '#BAC0C0', json: '#F0B476', js: '#F0B476', css: '#8FBFB4', lock: '#BAC0C0', xml: '#BAC0C0', env: '#828D9A' })[e] || '#BAC0C0'; }
lang(e) { return ({ php: 'PHP', md: 'Markdown', json: 'JSON', js: 'JavaScript', css: 'CSS', xml: 'XML', env: 'Properties' })[e] || 'Plain Text'; }
base(p) { return p.split('/').pop(); }
dir(p) { const i = p.lastIndexOf('/'); return i < 0 ? '' : p.slice(0, i); }
status(p, F) { const f = (F || this.state.files)[p]; if (!f) return ''; if (f.orig === null) return 'A'; if (f.content === null) return 'D'; return f.orig !== f.content ? 'M' : ''; }
changed(F) { F = F || this.state.files; return Object.keys(F).filter(p => this.status(p, F)).sort(); }
toast(t) { clearTimeout(this.toastT); this.setState({ toast: t }); this.toastT = setTimeout(() => this.setState({ toast: null }), 2400); }
copy(t, label) { try { navigator.clipboard && navigator.clipboard.writeText(t); } catch (e) {} this.toast((label || 'Copied') + ' — ' + t); }
speed() { return ({ slow: 1.8, normal: 1, fast: 0.4 })[this.props.claudeSpeed || 'normal'] || 1; }
diffOps(a, b) {
const n = a.length, m = b.length, dp = [];
for (let i = 0; i <= n; i++) dp.push(new Int32Array(m + 1));
for (let i = n - 1; i >= 0; i--) for (let j = m - 1; j >= 0; j--) dp[i][j] = a[i] === b[j] ? dp[i + 1][j + 1] + 1 : Math.max(dp[i + 1][j], dp[i][j + 1]);
const ops = []; let i = 0, j = 0;
while (i < n && j < m) { if (a[i] === b[j]) { ops.push({ t: '=', i, j }); i++; j++; } else if (dp[i + 1][j] >= dp[i][j + 1]) { ops.push({ t: '-', i }); i++; } else { ops.push({ t: '+', j }); j++; } }
while (i < n) ops.push({ t: '-', i: i++ }); while (j < m) ops.push({ t: '+', j: j++ });
return ops;
}
fileOps(p) { const f = this.state.files[p]; return f ? this.diffOps(this.lines(f.orig), this.lines(f.content)) : []; }
stats(p) { let a = 0, d = 0; this.fileOps(p).forEach(o => { if (o.t === '+') a++; if (o.t === '-') d++; }); return { a, d }; }
marks(p) {
const m = {}; let pend = 0;
if (this.status(p) === 'A') { this.lines(this.state.files[p].content).forEach((_, j) => m[j] = '#8FBFB4'); return m; }
this.fileOps(p).forEach(o => { if (o.t === '-') pend++; else if (o.t === '+') { m[o.j] = pend > 0 ? '#F0B476' : '#8FBFB4'; if (pend > 0) pend--; } else pend = 0; });
return m;
}
segs(text) {
return text.split(/(\*\*[^*]+\*\*|`[^`]+`)/).filter(Boolean).map(t => {
if (t.startsWith('**')) return { t: t.slice(2, -2), color: '#F4F5F4', weight: 700, family: 'inherit' };
if (t.startsWith('`')) return { t: t.slice(1, -1), color: '#F0B476', weight: 400, family: "'IBM Plex Mono',monospace" };
return { t, color: 'inherit', weight: 'inherit', family: 'inherit' };
});
}
// ---------- file ops ----------
setFiles(fn, extra) { this.setState(s => { const files = { ...s.files }; fn(files, s); return { files, ...(extra ? extra(s, files) : {}) }; }); }
open(p, line) {
if (!this.state.files[p] || this.state.files[p].content === null) { this.setState({ selected: p }); this.openDiff(p); return; }
const parts = p.split('/'); const exp = new Set(this.state.expanded);
for (let i = 1; i < parts.length; i++) exp.add(parts.slice(0, i).join('/'));
this.setState(s => ({ current: p, selected: p, view: 'edit', expanded: [...exp], ln: line || 1, col: 1, panels: { ...s.panels, file: true } }));
if (line) this.later(() => this.jumpTo(line), 60);
}
jumpTo(line) {
const ta = this.taRef.current; if (!ta) return;
const L = ta.value.split('\n'); let pos = 0; for (let i = 0; i < line - 1 && i < L.length; i++) pos += L[i].length + 1;
ta.focus(); ta.setSelectionRange(pos, pos + (L[line - 1] || '').length);
const sc = ta.parentElement && ta.parentElement.parentElement; const lh = this.lineHpx();
if (sc) sc.scrollTop = Math.max(0, (line - 6) * lh);
}
stage(p) { this.setState(s => ({ staged: s.staged.includes(p) ? s.staged : [...s.staged, p] })); }
unstage(p) { this.setState(s => ({ staged: s.staged.filter(x => x !== p) })); }
stageAll() { this.setState({ staged: this.changed() }); this.toast('Staged all changes'); }
discard(p) {
this.setFiles(F => { const f = F[p]; if (!f) return; if (f.orig === null) delete F[p]; else F[p] = { orig: f.orig, content: f.orig }; },
(s, F) => ({ staged: s.staged.filter(x => x !== p), current: F[p] && F[p].content !== null ? s.current : (s.current === p ? this.firstFile(F) : s.current), diffPath: null }));
this.toast('Discarded changes to ' + this.base(p));
}
firstFile(F) { return Object.keys(F).find(p => F[p].content !== null && !p.startsWith('.')) || null; }
confirmDiscard(p) {
this.setState({ menu: null, modal: { kind: 'confirm', title: 'Discard changes to ' + p + '?', body: this.status(p) === 'A' ? 'This deletes the new file and cannot be undone.' : 'This reverts the file to the last commit and cannot be undone.', confirm: 'Discard', onConfirm: () => this.discard(p) } });
}
deletePath(p, isDir) {
this.setFiles(F => { Object.keys(F).forEach(k => { if (k === p || (isDir && k.startsWith(p + '/'))) { if (F[k].orig === null) delete F[k]; else F[k] = { orig: F[k].orig, content: null }; } }); },
(s, F) => ({ emptyDirs: s.emptyDirs.filter(d => d !== p && !d.startsWith(p + '/')), current: F[s.current] && F[s.current].content !== null ? s.current : this.firstFile(F) }));
this.toast('Deleted ' + p);
}
renamePath(p, name, isDir) {
name = name.trim(); if (!name || name.includes('/')) return;
const np = (this.dir(p) ? this.dir(p) + '/' : '') + name; if (np === p) return;
const mv = k => k === p ? np : (isDir && k.startsWith(p + '/') ? np + k.slice(p.length) : k);
this.setFiles(F => { Object.keys(F).forEach(k => { const nk = mv(k); if (nk === k || F[k].content === null) return; F[nk] = { orig: null, content: F[k].content }; if (F[k].orig === null) delete F[k]; else F[k] = { orig: F[k].orig, content: null }; }); },
s => ({ current: mv(s.current), selected: mv(s.selected), expanded: s.expanded.map(mv), emptyDirs: s.emptyDirs.map(mv) }));
this.toast('Renamed to ' + name);
}
newFile(dir) { this.setState({ menu: null, modal: { kind: 'prompt', title: 'New file in ' + (dir || 'odynt') + '/', input: 'untitled.md', confirm: 'Create', onConfirm: v => { v = v.trim(); if (!v) return; const p = (dir ? dir + '/' : '') + v; if (this.state.files[p] && this.state.files[p].content !== null) { this.toast('— ' + p + ' already exists.'); return; } this.setFiles(F => { F[p] = { orig: F[p] ? F[p].orig : null, content: '' }; }); this.later(() => this.open(p), 0); } } }); }
newFolder(dir) { this.setState({ menu: null, modal: { kind: 'prompt', title: 'New folder in ' + (dir || 'odynt') + '/', input: 'new-folder', confirm: 'Create', onConfirm: v => { v = v.trim(); if (!v) return; const p = (dir ? dir + '/' : '') + v; this.setState(s => ({ emptyDirs: [...s.emptyDirs, p], expanded: [...s.expanded, dir, p].filter(Boolean) })); } } }); }
commit() {
const s = this.state; const msg = s.commitMsg.trim();
if (!s.staged.length) { this.toast(this.changed().length ? '— Stage changes first.' : '— Nothing to commit.'); return; }
if (!msg) { this.toast('— Write a commit message first.'); return; }
const sha = Math.random().toString(16).slice(2, 9); const n = s.staged.length;
this.setFiles(F => { s.staged.forEach(p => { if (!F[p]) return; if (F[p].content === null) delete F[p]; else F[p] = { orig: F[p].content, content: F[p].content }; }); },
st => ({ staged: [], commitMsg: '', ahead: st.ahead + 1, commits: [{ sha, msg: msg.split('\n')[0] }, ...st.commits] }));
this.toast('Committed ' + n + (n === 1 ? ' file' : ' files') + ' · ' + sha);
}
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 }); }
// ---------- 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); }
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) {
if (!ps.length) return; const un = this.changed().filter(p => !this.state.staged.includes(p));
this.setState(s => ({ staged: [...new Set([...s.staged, ...ps])] }));
this.glog_(cmd || (ps.length > 1 && ps.length === un.length ? 'git add -A' : 'git add ' + ps.join(' ')), []);
}
gUnstage(ps, cmd) {
if (!ps.length) return;
this.setState(s => ({ staged: s.staged.filter(x => !ps.includes(x)), gitOpenFiles: s.gitOpenFiles.filter(k => !ps.some(p => k === 'staged:' + p)) }));
this.glog_(cmd || 'git restore --staged ' + (ps.length > 1 && ps.length === this.state.staged.length ? '.' : ps.join(' ')), []);
}
gDiscard(ps) {
if (!ps.length) return;
const nw = ps.filter(p => this.status(p) === 'A'), old = ps.filter(p => this.status(p) !== 'A');
const onlyDel = !nw.length && old.every(p => this.status(p) === 'D'), one = ps.length === 1;
const go = () => {
this.setFiles(F => { ps.forEach(p => { const f = F[p]; if (!f) return; if (f.orig === null) delete F[p]; else F[p] = { orig: f.orig, content: f.orig }; }); },
(s, F) => ({ staged: s.staged.filter(x => !ps.includes(x)), gitOpenFiles: s.gitOpenFiles.filter(k => !ps.some(p => k.endsWith(':' + p))), current: F[s.current] && F[s.current].content !== null ? s.current : this.firstFile(F) }));
if (old.length) this.glog_('git restore ' + old.join(' '), []);
if (nw.length) this.glog_('git clean -f ' + nw.join(' '), nw.map(p => 'Removing ' + p));
};
if (onlyDel) { go(); return; }
const what = one ? ps[0] : ps.length + ' files';
this.setState({ menu: null, modal: { kind: 'confirm', title: (nw.length && !old.length ? 'Delete ' : 'Discard changes to ') + what + '?', body: nw.length ? 'New files are removed from disk. This cannot be undone.' : 'This reverts to the last commit and cannot be undone.', confirm: nw.length && !old.length ? 'Delete' : 'Discard', onConfirm: go } });
}
gCommit(andPush, msgIn, cmdIn) {
const s = this.state, msg = (msgIn != null ? msgIn : s.commitMsg).trim(), first = msg.split('\n')[0];
const st = s.staged.filter(p => this.status(p));
const cmd = cmdIn || (msg ? 'git commit -m "' + first + '"' : 'git commit');
if (!st.length) { this.glog_(cmd, [{ t: this.changed().length ? 'no changes added to commit (use "git add" and/or "git commit -a")' : 'nothing to commit, working tree clean', c: '#F0B476' }]); return; }
if (!msg) { this.glog_(cmd, [{ t: 'Aborting commit due to empty commit message.', c: '#F0B476' }]); this.gitMsgRef.current && this.gitMsgRef.current.focus(); return; }
let a = 0, d = 0; const modes = [];
st.forEach(p => { const x = this.stats(p), k = this.status(p); a += x.a; d += x.d; if (k === 'A') modes.push(' create mode 100644 ' + p); if (k === 'D') modes.push(' delete mode 100644 ' + p); });
const sha = Math.random().toString(16).slice(2, 9), n = st.length;
this.setFiles(F => { st.forEach(p => { if (!F[p]) return; if (F[p].content === null) delete F[p]; else F[p] = { orig: F[p].content, content: F[p].content }; }); },
x => ({ staged: [], commitMsg: '', ahead: x.ahead + 1, commits: [{ sha, msg: first }, ...x.commits], gitOpenFiles: x.gitOpenFiles.filter(k => !k.startsWith('staged:')) }));
this.glog_(cmd, ['[' + s.BR + ' ' + sha + '] ' + first, ' ' + n + (n === 1 ? ' file' : ' files') + ' changed, ' + a + ' insertions(+), ' + d + ' deletions(-)', ...modes]);
if (andPush) this.later(() => this.gPush(), 300);
}
gPush(cmdIn) {
if (this.state.gBusy) return;
const s = this.state, BR = s.BR, sp = this.speed(), R = 'github.com:blijnder/odynt.git';
this.glog_(cmdIn || 'git push origin ' + BR, []);
if (s.behind) { this.later(() => this.glogAdd(['To ' + R, { t: ' ! [rejected] ' + BR + ' -> ' + BR + ' (fetch first)', c: '#E8913A' }, { t: "error: failed to push some refs to '" + R + "'", c: '#E8913A' }, { t: 'hint: Updates were rejected because the remote contains work that you do not', c: '#828D9A' }, { t: 'hint: have locally. Pull first, then push again.', c: '#828D9A' }]), 600 * sp); return; }
if (!s.ahead) { this.later(() => this.glogAdd(['Everything up-to-date']), 400 * sp); return; }
this.setState({ gBusy: 'push' });
this.later(() => {
const st = this.state, n = st.ahead * 3 + 2, w = st.ahead * 2 + 1, base = st.pulled ? '7a1e0f2' : '4be21a9', head = st.commits[0] ? st.commits[0].sha : base;
this.glogAdd(['Enumerating objects: ' + n + ', done.', 'Counting objects: 100% (' + n + '/' + n + '), done.', 'Delta compression using up to 10 threads', 'Writing objects: 100% (' + w + '/' + w + '), 1.42 KiB | 1.42 MiB/s, done.', 'To ' + R, { t: ' ' + base + '..' + head + ' ' + BR + ' -> ' + BR, c: '#8FBFB4' }]);
this.toast('Pushed ' + st.ahead + (st.ahead === 1 ? ' commit' : ' commits') + ' to origin');
this.setState({ gBusy: null, ahead: 0 });
}, 1100 * sp);
}
gPull(cmdIn) {
if (this.state.gBusy) return;
const s = this.state, BR = s.BR, b = s.behind, sp = this.speed();
this.glog_(cmdIn || 'git pull', []);
if (!b) { this.later(() => this.glogAdd(['Already up to date.']), 400 * sp); return; }
this.setState({ gBusy: 'pull' });
this.later(() => {
const a = this.state.ahead, out = ['From github.com:blijnder/odynt', ' * branch ' + BR + ' -> FETCH_HEAD'];
if (a) out.push("Merge made by the 'ort' strategy."); else out.push('Updating 4be21a9..7a1e0f2', 'Fast-forward');
out.push(' app/Http/Middleware/McpTokenAuth.php | 9 +++++----', ' ontwikkelingen/2026-10-06-001-one-user-mcp-connection/deliver.md | 2 +-', ' 2 files changed, 6 insertions(+), 5 deletions(-)');
this.glogAdd(out);
this.toast('Pulled ' + b + ' commits from origin/' + BR);
this.setState(st => ({ gBusy: null, behind: 0, pulled: true, ahead: a ? st.ahead + 1 : st.ahead, commits: a ? [{ sha: Math.random().toString(16).slice(2, 9), msg: "Merge branch '" + BR + "' of github.com:blijnder/odynt" }, ...st.commits] : st.commits }));
}, 1100 * sp);
}
gSwitch(name, remote) {
const s = this.state, n = this.changed().length;
if (name === s.BR && !remote) return;
if (n) { this.glog_('git switch ' + name, [{ t: 'error: Your local changes to ' + n + (n === 1 ? ' file' : ' files') + ' would be overwritten by checkout.', c: '#E8913A' }, { t: 'Please commit your changes or stash them before you switch branches.', c: '#E8913A' }, 'Aborting']); return; }
const isNew = remote && !s.branches.includes(name);
if (remote && !isNew && name === s.BR) return;
this.glog_('git switch ' + name, isNew ? ["branch '" + name + "' set up to track 'origin/" + name + "'.", "Switched to a new branch '" + name + "'"] : ["Switched to branch '" + name + "'", "Your branch is up to date with 'origin/" + name + "'."]);
this.setState(x => ({ BR: name, branches: isNew ? [...x.branches, name] : x.branches, ahead: 0, behind: 0, pulled: false, commits: [], staged: [], gitOpenFiles: [] }));
this.toast('Switched to ' + name);
}
gStatus() {
const s = this.state, ch = this.changed(), st = ch.filter(p => s.staged.includes(p)), un = ch.filter(p => !s.staged.includes(p)), O = "'origin/" + s.BR + "'";
const o = ['On branch ' + s.BR];
if (s.ahead && s.behind) o.push('Your branch and ' + O + ' have diverged,', 'and have ' + s.ahead + ' and ' + s.behind + ' different commits each, respectively.');
else if (s.ahead) o.push('Your branch is ahead of ' + O + ' by ' + s.ahead + (s.ahead === 1 ? ' commit.' : ' commits.'));
else if (s.behind) o.push('Your branch is behind ' + O + ' by ' + s.behind + ' commits, and can be fast-forwarded.');
else o.push('Your branch is up to date with ' + O + '.');
const lab = { M: 'modified: ', A: 'new file: ', D: 'deleted: ' };
if (st.length) { o.push('', 'Changes to be committed:'); st.forEach(p => o.push({ t: '\t' + lab[this.status(p)] + p, c: '#8FBFB4' })); }
const um = un.filter(p => this.status(p) !== 'A'), ua = un.filter(p => this.status(p) === 'A');
if (um.length) { o.push('', 'Changes not staged for commit:'); um.forEach(p => o.push({ t: '\t' + lab[this.status(p)] + p, c: '#F0B476' })); }
if (ua.length) { o.push('', 'Untracked files:'); ua.forEach(p => o.push({ t: '\t' + p, c: '#F0B476' })); }
if (!ch.length) o.push('', 'nothing to commit, working tree clean');
return o;
}
gLogLines() {
const s = this.state, L = s.commits.map(x => ({ t: x.sha + ' ' + x.msg, c: '#F0B476' }));
if (s.pulled) L.push({ t: '7a1e0f2 Return 401 without stack trace for revoked MCP tokens', c: '#F0B476' }, { t: 'c3d9b14 Fix vault create link in deliver.md', c: '#F0B476' });
L.push({ t: '4be21a9 Add one-user MCP key flow', c: '#F0B476' }, { t: '91c0d3e Seed Vaults for MCP tests', c: '#F0B476' });
return L;
}
gRun(raw) {
let c = (raw || '').trim(); this.setState(x => ({ gInput: '', gHist: c ? [...x.gHist, c] : x.gHist })); if (!c) return;
if (c === 'clear') { this.setState({ glog: [] }); return; }
if (!/^git(\s|$)/.test(c)) c = 'git ' + c;
const s = this.state, ch = this.changed(), un = ch.filter(p => !s.staged.includes(p)), st = ch.filter(p => s.staged.includes(p));
const args = c.slice(3).trim(), sub = args.split(/\s+/)[0] || '', rest = args.slice(sub.length).trim();
const match = (list, r) => r === '.' || r === '-A' || r === '--all' || !r ? list : list.filter(p => p === r || p.startsWith(r.replace(/\/$/, '') + '/'));
const err = t => this.glog_(c, [{ t, c: '#E8913A' }]);
if (sub === 'status') this.glog_(c, this.gStatus());
else if (sub === 'add') { if (!rest) { err('Nothing specified, nothing added.'); return; } const ps = match(un, rest); ps.length ? this.gStage(ps, c) : err("fatal: pathspec '" + rest + "' did not match any files"); }
else if (sub === 'restore' && rest.startsWith('--staged')) { const r = rest.slice(8).trim(), ps = match(st, r); ps.length ? this.gUnstage(ps, c) : err("error: pathspec '" + (r || '.') + "' did not match any file(s) known to git"); }
else if (sub === 'commit') { let m = /-m\s+(["'])([\s\S]*?)\1/.exec(rest), msg = ''; if (m) msg = m[2]; else { m = /-m\s+(\S+)/.exec(rest); if (m) msg = m[1]; } this.gCommit(false, msg || s.commitMsg, c); }
else if (sub === 'push') this.gPush(c);
else if (sub === 'pull') this.gPull(c);
else if (sub === 'log') this.glog_(c, this.gLogLines());
else if (sub === 'diff') { const ps = rest.includes('--staged') || rest.includes('--cached') ? st : un; let A = 0, D = 0; const o = ps.map(p => { const x = this.stats(p); A += x.a; D += x.d; return ' ' + p + ' | ' + (x.a + x.d) + ' ' + '+'.repeat(Math.min(x.a, 20)) + '-'.repeat(Math.min(x.d, 20)); }); if (ps.length) o.push(' ' + ps.length + ' files changed, ' + A + ' insertions(+), ' + D + ' deletions(-)'); this.glog_(c, o); }
else if (sub === 'fetch') this.glog_(c, s.behind && !s.pulled ? [] : []);
else if (sub === 'branch') this.glog_(c, [...s.branches.map(b => b === s.BR ? { t: '* ' + b, c: '#E8913A' } : ' ' + b), ...(rest.includes('-a') ? s.remotes.map(r => ' remotes/origin/' + r) : [])]);
else if (sub === 'switch' || sub === 'checkout') { const nm = rest.replace(/^-[a-z]\s+/, '').replace(/^origin\//, ''); if (s.branches.includes(nm)) this.gSwitch(nm, false); else if (s.remotes.includes(nm)) this.gSwitch(nm, true); else err("fatal: invalid reference: " + nm); }
else err("git: '" + sub + "' is not a git command. Here: status, add, restore --staged, commit -m, push, pull, log, diff, branch.");
}
gitRows(p) {
const f = this.state.files[p]; if (!f) return [];
const a = this.lines(f.orig), b = this.lines(f.content), ops = this.diffOps(a, b), rows = [], E = 'rgba(35,44,57,.35)';
let dels = [], adds = [];
const flush = () => { const n = Math.max(dels.length, adds.length); for (let k = 0; k < n; k++) { const dl = dels[k], ad = adds[k];
const lt = dl ? a[dl.i] : '', rt = ad ? b[ad.j] : ''; let lp = 0, ls = 0;
if (dl && ad) { const mx = Math.min(lt.length, rt.length); while (lp < mx && lt[lp] === rt[lp]) lp++; while (ls < mx - lp && lt[lt.length - 1 - ls] === rt[rt.length - 1 - ls]) ls++; }
const both = !!(dl && ad) && lp + ls > 0;
const sp = t => both ? { a: t.slice(0, lp), m: t.slice(lp, t.length - ls), b: t.slice(t.length - ls) } : { a: t, m: '', b: '' };
const L = sp(lt), R = sp(rt);
rows.push({ eq: false, isLine: true, isSep: false, ln: dl ? dl.i + 1 : '', la: L.a, lm: L.m, lb: L.b, lbg: dl ? 'rgba(232,145,58,.12)' : E, lhl: 'rgba(232,145,58,.38)', lnc: dl ? '#F0B476' : '#3A424C',
rn: ad ? ad.j + 1 : '', ra: R.a, rm: R.m, rb: R.b, rbg: ad ? 'rgba(143,191,180,.12)' : E, rhl: 'rgba(143,191,180,.36)', rnc: ad ? '#8FBFB4' : '#3A424C' }); } dels = []; adds = []; };
ops.forEach(o => { if (o.t === '-') dels.push(o); else if (o.t === '+') adds.push(o); else { flush(); rows.push({ eq: true, isLine: true, isSep: false, ln: o.i + 1, la: a[o.i], lm: '', lb: '', lbg: 'transparent', lhl: 'transparent', lnc: '#3A424C', rn: o.j + 1, ra: b[o.j], rm: '', rb: '', rbg: 'transparent', rhl: 'transparent', rnc: '#3A424C' }); } });
flush();
const keep = rows.map(() => false); rows.forEach((r, i) => { if (!r.eq) for (let k = i - 3; k <= i + 3; k++) if (k >= 0 && k < rows.length) keep[k] = true; });
const out = [], sep = g => ({ isSep: true, isLine: false, label: '⋯ ' + g + ' unchanged line' + (g === 1 ? '' : 's') }); let gap = 0;
rows.forEach((r, i) => { if (keep[i]) { if (gap) out.push(sep(gap)); gap = 0; out.push(r); } else gap++; });
if (gap && out.length) out.push(sep(gap));
if (!out.length) out.push({ isSep: true, isLine: false, label: '— No line changes.' });
return out;
}
gitFileItems(p) {
const it = [];
if (this.status(p) !== 'D') it.push({ label: 'Open in editor', icon: 'file-text', bold: true, run: () => { this.setState({ gitOpen: false }); this.open(p); } });
it.push({ sep: it.length > 0, label: 'Pass on reference', icon: 'sparkle', run: () => { this.setState({ gitOpen: false }); this.passOn('@' + p); } });
it.push({ label: 'Copy reference', icon: 'files', run: () => this.copy('@' + p, 'Copied reference') });
return it;
}
// ---------- menus ----------
openMenu(e, title, items) {
e.preventDefault(); e.stopPropagation();
const h = items.length * 38 + (title ? 40 : 12) + items.filter(i => i.sep).length * 13;
const x = Math.min(e.clientX, window.innerWidth - 310), y = Math.min(e.clientY, window.innerHeight - h - 10);
this.setState({ menu: { x: Math.max(8, x), y: Math.max(8, y), title, items } });
}
passOn(text) {
this.setState(s => ({ menu: null, panels: { ...s.panels, claude: true }, claudeInput: (s.claudeInput && !s.claudeInput.endsWith(' ') ? s.claudeInput + ' ' : s.claudeInput) + text + ' ' }));
this.later(() => { const el = this.claudeRef.current; if (el) { el.focus(); el.setSelectionRange(el.value.length, el.value.length); } }, 30);
this.toast('Passed on to Claude — ' + text);
}
fileItems(p, withFileOps) {
const st = this.status(p), staged = this.state.staged.includes(p), name = this.base(p);
const it = [
{ label: 'Pass on reference', icon: 'sparkle', run: () => this.passOn('@' + p) },
{ label: 'Copy reference', icon: 'files', run: () => this.copy('@' + p, 'Copied reference') },
{ label: 'Pass on file name', icon: 'sparkle', run: () => this.passOn(name) },
{ label: 'Copy file name', icon: 'files', run: () => this.copy(name, 'Copied file name') }
];
if (st) {
it.push({ sep: true, label: staged ? 'Unstage changes' : 'Stage changes', icon: staged ? 'minus' : 'plus', run: () => staged ? this.unstage(p) : this.stage(p) });
it.push({ label: 'Open diff', icon: 'arrow-left-right', run: () => this.openDiff(p) });
it.push({ label: 'Discard changes', icon: 'undo-2', danger: true, run: () => this.confirmDiscard(p) });
}
if (withFileOps && st !== 'D') {
it.push({ sep: true, label: 'Rename file', icon: 'pencil', run: () => this.setState({ modal: { kind: 'prompt', title: 'Rename ' + p, input: name, confirm: 'Rename', onConfirm: v => this.renamePath(p, v, false) } }) });
it.push({ label: 'Show in Finder', icon: 'folder', run: () => this.toast('Revealed in Finder — ~/code/odynt/' + p) });
it.push({ label: 'Delete file', icon: 'trash-2', danger: true, run: () => this.setState({ modal: { kind: 'confirm', title: 'Delete ' + p + '?', body: 'The file moves to the Trash. Git still has the last commit.', confirm: 'Delete', onConfirm: () => this.deletePath(p, false) } }) });
}
return it;
}
dirItems(p) {
const it = [];
const isOnt = p.startsWith('ontwikkelingen/') && p.split('/').length === 2;
if (isOnt) it.push({ label: 'Bouwen', icon: 'hammer', bold: true, run: () => { this.setState({ menu: null }); this.send('Bouw @' + p); } });
it.push({ sep: isOnt, label: 'Pass on reference', icon: 'sparkle', run: () => this.passOn('@' + p + '/') });
it.push({ label: 'Copy reference', icon: 'files', run: () => this.copy('@' + p + '/', 'Copied reference') });
it.push({ sep: true, label: 'New file', icon: 'file-plus', run: () => this.newFile(p) });
it.push({ label: 'New folder', icon: 'folder-plus', run: () => this.newFolder(p) });
it.push({ sep: true, label: 'Rename folder', icon: 'pencil', run: () => this.setState({ modal: { kind: 'prompt', title: 'Rename ' + p + '/', input: this.base(p), confirm: 'Rename', onConfirm: v => this.renamePath(p, v, true) } }) });
it.push({ label: 'Show in Finder', icon: 'folder', run: () => this.toast('Revealed in Finder — ~/code/odynt/' + p) });
it.push({ label: 'Delete folder', icon: 'trash-2', danger: true, run: () => this.setState({ modal: { kind: 'confirm', title: 'Delete ' + p + '/?', body: 'Everything inside moves to the Trash.', confirm: 'Delete', onConfirm: () => this.deletePath(p, true) } }) });
return it;
}
lineHpx() { return Math.round((this.props.fontSize || 14) * 1.6); }
onEditorMenu = e => {
const ta = e.target, p = this.state.current; if (!p) return;
const v = ta.value, s = ta.selectionStart, en = ta.selectionEnd;
if (en > s) {
const l1 = v.slice(0, s).split('\n').length, l2 = v.slice(0, en).split('\n').length;
const ref = '@' + p + '#L' + l1 + (l2 > l1 ? '-' + l2 : '');
this.openMenu(e, null, [
{ label: 'Pass on selection', icon: 'sparkle', bold: true, run: () => this.passOn(ref) },
{ label: 'Copy reference', icon: 'files', run: () => this.copy(ref, 'Copied reference') }
]);
return;
}
const r = ta.getBoundingClientRect();
const line = Math.max(1, Math.min(v.split('\n').length, Math.floor((e.clientY - r.top - 18) / this.lineHpx()) + 1));
const ref = '@' + p + '#L' + line;
const items = [
{ label: 'Pass on reference', icon: 'sparkle', run: () => this.passOn(ref) },
{ label: 'Copy reference', icon: 'files', run: () => this.copy(ref, 'Copied reference') }
];
if (this.marks(p)[line - 1] || this.status(p)) items.push({ sep: true, label: 'Show diff', icon: 'arrow-left-right', bold: !!this.marks(p)[line - 1], run: () => this.openDiff(p) });
this.openMenu(e, null, items);
};
// ---------- claude ----------
push_(e) { this.setState(s => ({ entries: [...s.entries, e] })); }
send(text) {
text = (text || '').trim(); if (!text) return;
if (this.state.running) { this.toast('— Claude is still working. Esc interrupts.'); return; }
this.setState(s => ({ claudeInput: '', panels: { ...s.panels, claude: true }, entries: [...s.entries, { kind: 'user', text }] }));
this.run(this.scenario(text));
}
scenario(text) {
const t = text.toLowerCase(), F = this.state.files, steps = [];
const refs = (text.match(/@[^\s]+/g) || []).map(r => r.slice(1));
const CFG = 'config/ai.php';
const cfgUpdate = () => {
if (this.done.cfg) return;
this.done.cfg = true;
const add = `
'compression' => [
'enabled' => false,
'presets' => [
'short' => ['keep_turns' => 12, 'summary_tokens' => 1_024],
'general' => ['keep_turns' => 24, 'summary_tokens' => 4_096],
'long' => ['keep_turns' => 48, 'summary_tokens' => 16_384],
],
],
'models' => [`;
steps.push({ verb: 'Reading', ms: 900, entry: { kind: 'tool', tool: 'Read', arg: CFG, path: CFG, detail: [{ t: 'Read 20 lines', c: '#828D9A' }] } });
steps.push({ verb: 'Editing', ms: 1400, run: () => this.setFiles(Fs => { const c = Fs[CFG].content; let n = c.replace(`\n 'models' => [`, add); n = n.replace(/'context' => (\d[\d_]*),\n/g, (m, v) => `'context' => ${v},\n 'cache' => ['min_tokens' => ${v === '200_000' ? '4_096' : '512'}],\n 'compression' => ${v === '200_000' ? 'false' : 'true'},\n`); Fs[CFG] = { orig: Fs[CFG].orig, content: n }; }),
entry: { kind: 'tool', tool: 'Update', arg: CFG, path: CFG, detail: [
{ t: 'Updated config/ai.php with 15 additions', c: '#828D9A' },
{ t: "+ 'compression' => [", c: '#E4E7E6', bg: 'rgba(143,191,180,.14)' },
{ t: "+ 'enabled' => false,", c: '#E4E7E6', bg: 'rgba(143,191,180,.14)' },
{ t: "+ 'presets' => [ 'short', 'general', 'long' ],", c: '#E4E7E6', bg: 'rgba(143,191,180,.14)' },
{ t: "+ 'cache' => ['min_tokens' => 512],", c: '#E4E7E6', bg: 'rgba(143,191,180,.14)' }
] } });
};
if (/\b(bouw|bouwen|build)\b/.test(t)) {
const folder = (refs[0] || 'ontwikkelingen/001-compression-caching-toggles-2026-10-09').replace(/\/$/, '');
const intent = folder + '/intent-raw.md', plan = folder + '/plan.md';
const has = F[intent] && F[intent].content !== null;
steps.push({ verb: 'Reading', ms: 1000, entry: { kind: 'tool', tool: 'Read', arg: has ? intent : folder + '/', path: has ? intent : null, detail: [{ t: has ? 'Read ' + this.lines(F[intent].content).length + ' lines' : 'No intent-raw.md — reading folder', c: '#828D9A' }] } });
steps.push({ verb: 'Planning', ms: 1500, run: () => this.setFiles(Fs => { Fs[plan] = { orig: Fs[plan] ? Fs[plan].orig : null, content: `# Plan: ${this.base(folder)}
Built from intent-raw.md. Not grilled yet — three points need a decision.
## Steps
- **Config:** add \`compression\` with three presets and a per-model \`cache.min_tokens\` to \`config/ai.php\`.
- **Agent form:** a toggle for compression and one for caching. Each shows only when the selected model supports it.
- **Preset select:** short, general, long. The preset writes the model's values.
- **History cache:** move the cache breakpoint to the last user turn.
## Open points
- Compression rewrites the history, so caching breaks on the next turn. Which wins when both are on?
- Haiku 4.5 needs 4096 tokens before it caches. Hide the toggle below that, or show it disabled?
- Do we store \`input_tokens\` per message now, or in a follow-up?` }; }, s => ({ expanded: [...new Set([...s.expanded, 'ontwikkelingen', folder])] })),
entry: { kind: 'tool', tool: 'Write', arg: plan, path: plan, detail: [{ t: 'Wrote 19 lines to ' + this.base(plan), c: '#828D9A' }] } });
cfgUpdate();
steps.push({ verb: 'Writing', ms: 700, say: `I made a plan in \`${this.base(folder)}/plan.md\` and added the config part already.
- **Config:** \`config/ai.php\` now has a \`compression\` block with three presets, and every model has \`cache.min_tokens\`.
- **Not built yet:** the agent form toggles. I want your call on three open points first — they are at the bottom of the plan.
Both files are in **Changes**. Nothing is staged.` });
} else if (/\btest/.test(t)) {
steps.push({ verb: 'Running', ms: 2200, entry: { kind: 'tool', tool: 'Bash', arg: 'php artisan test --compact', detail: [
{ t: 'Tests: 142 passed (418 assertions)', c: '#8FBFB4' }, { t: 'Duration: 9.84s', c: '#828D9A' }] } });
steps.push({ verb: 'Writing', ms: 500, say: 'All **142** tests pass. No test covers the new `compression` config yet — say so and I add one to `tests/Feature/`.' });
} else if (/\b(stage|commit)\b/.test(t)) {
steps.push({ verb: 'Staging', ms: 900, run: () => this.setState({ staged: this.changed() }), entry: { kind: 'tool', tool: 'Bash', arg: 'git add -A', detail: [{ t: this.changed().length + ' files staged', c: '#828D9A' }] } });
steps.push({ verb: 'Writing', ms: 400, say: 'Staged everything. I leave the commit to you — open **Git** with ⌘G to write the message. A suggestion: `Add compression presets and per-model cache size`.' });
} else if (!this.done.cfg && /(compress|cach|config|preset|toggle)/.test(t)) {
cfgUpdate();
steps.push({ verb: 'Writing', ms: 500, say: 'Added a `compression` block with presets **short**, **general** and **long** to `config/ai.php`, plus `cache.min_tokens` per model: 512 on the 5.x models, 4096 on Haiku 4.5. Open the file from **Changes** to review.' });
} else {
if (refs.length) refs.forEach(r => { const p = r.split('#')[0].replace(/\/$/, ''); const f = F[p]; steps.push({ verb: 'Reading', ms: 800, entry: { kind: 'tool', tool: 'Read', arg: r, path: f && f.content !== null ? p : null, detail: [{ t: f && f.content !== null ? 'Read ' + this.lines(f.content).length + ' lines' : 'Listed folder', c: '#828D9A' }] } }); });
steps.push({ verb: 'Thinking', ms: 1200, say: refs.length
? `I read \`${refs.map(r => this.base(r.split('#')[0].replace(/\/$/, ''))).join('`, `')}\`. ${refs.some(r => r.includes('#L')) ? 'The lines you passed on say the presets should set values per model — that fits in `config/ai.php`, next to the model limits.' : 'It matches the raw intent: two toggles, three presets, values defined next to the models.'}
Tell me to **bouw** it, or ask about one part.`
: 'Understood. Pass on a file or a selection (right-click) and I work from that, or say **bouw** to build the open ontwikkeling.' });
}
return steps;
}
run(steps) {
const id = ++this.runId, start = Date.now(); let i = 0;
this.setState({ running: true, verb: 'Thinking' });
const next = () => {
if (id !== this.runId) return;
if (i >= steps.length) {
const s = Math.max(1, Math.round((Date.now() - start) / 1000)), d = new Date();
const h = d.getHours(), mm = String(d.getMinutes()).padStart(2, '0');
this.setState(st => ({ running: false, entries: [...st.entries, { kind: 'meta', text: '✻ Baked for ' + s + 's · done ' + ((h % 12) || 12) + ':' + mm + (h < 12 ? ' AM' : ' PM') }] }));
return;
}
const st = steps[i++];
this.setState({ verb: st.verb || 'Thinking' });
this.later(() => {
if (id !== this.runId) return;
if (st.run) st.run();
if (st.entry) this.push_(st.entry);
if (st.say) this.stream(st.say, id, next); else next();
}, (st.ms || 600) * this.speed());
};
next();
}
stream(text, id, done) {
let n = 0; this.push_({ kind: 'text', text: '' });
const tick = () => {
if (id !== this.runId) return;
n = Math.min(text.length, n + 7);
this.setState(s => { const e = s.entries.slice(); e[e.length - 1] = { kind: 'text', text: text.slice(0, n) }; return { entries: e }; });
if (n < text.length) this.later(tick, 16 * this.speed()); else done();
};
tick();
}
interrupt() { if (!this.state.running) return; this.runId++; this.setState(s => ({ running: false, entries: [...s.entries, { kind: 'meta', text: '⎿ Interrupted · What should Claude do instead?' }] })); }
// ---------- terminal ----------
term(cmd) {
const out = [{ t: cmd, c: '#F4F5F4', p: true }]; const s = this.state; const c = cmd.trim();
const o = (t, col) => out.push({ t, c: col || '#BAC0C0' });
if (!c) {} else if (c === 'clear') { this.setState({ term: [], termInput: '' }); return; }
else if (c === 'help') o('help · ls · pwd · git status · git log · git diff --stat · php artisan test · echo · clear');
else if (c === 'pwd') o('/Users/jonathan/code/odynt');
else if (c === 'ls' || c === 'ls -la') { const top = new Set(); Object.keys(s.files).forEach(p => { if (s.files[p].content !== null) top.add(p.split('/')[0] + (p.includes('/') ? '/' : '')); }); s.emptyDirs.forEach(d => top.add(d.split('/')[0] + '/')); o([...top].filter(x => c === 'ls -la' || !x.startsWith('.')).sort().join(' ')); }
else if (c === 'git status') { o('On branch ' + s.BR); if (s.ahead) o('Your branch is ahead of origin by ' + s.ahead + ' commit(s).'); const ch = this.changed(); if (!ch.length) o('nothing to commit, working tree clean'); ch.forEach(p => o((s.staged.includes(p) ? ' staged: ' : ' modified: ') + p, s.staged.includes(p) ? '#8FBFB4' : '#F0B476')); }
else if (c === 'git log' || c === 'git log --oneline') { s.commits.forEach(x => o(x.sha + ' ' + x.msg, '#F0B476')); o('4be21a9 Add one-user MCP key flow', '#F0B476'); o('91c0d3e Seed Vaults for MCP tests', '#F0B476'); }
else if (c.startsWith('git diff')) { const ch = this.changed(); if (!ch.length) o('(no changes)'); ch.forEach(p => { const st = this.stats(p); o(' ' + p + ' | +' + st.a + ' -' + st.d); }); }
else if (c.startsWith('php artisan test')) { o(' PASS Tests\\Feature\\AppDataTest', '#8FBFB4'); o(' PASS Tests\\Feature\\Mcp\\AgentToolsTest', '#8FBFB4'); o(' Tests: 142 passed (418 assertions)', '#8FBFB4'); }
else if (c.startsWith('echo ')) o(c.slice(5));
else if (c.startsWith('cd')) o('');
else o('zsh: command not found: ' + c.split(' ')[0], '#F0B476');
this.setState(st => ({ term: [...st.term, ...out].slice(-300), termInput: '', history: [...st.history, c].filter(Boolean) }));
}
// ---------- lifecycle ----------
componentDidMount() {
this.onKey = e => {
const mod = e.metaKey || e.ctrlKey, k = (e.key || '').toLowerCase(), s = this.state;
if (mod && k === 'f') { e.preventDefault(); this.openSearch(); }
else if (mod && k === 'n') { e.preventDefault(); this.openNote(); }
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 && ['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.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(); }
};
window.addEventListener('keydown', this.onKey);
this.spinT = setInterval(() => { if (this.state.running) this.setState(s => ({ spin: s.spin + 1 })); }, 140);
}
componentWillUnmount() { window.removeEventListener('keydown', this.onKey); clearInterval(this.spinT); this.timers.forEach(clearTimeout); clearTimeout(this.toastT); }
componentDidUpdate(pp, ps) {
const t = this.transcriptRef.current; if (t && (ps.entries !== this.state.entries || ps.running !== this.state.running)) t.scrollTop = t.scrollHeight;
const gl = this.glogRef.current; if (gl && ps.glog !== this.state.glog) gl.scrollTop = gl.scrollHeight;
const r = this.termRef.current; if (r && ps.term !== this.state.term) r.scrollTop = r.scrollHeight;
const m = this.state.modal; if (m && (!ps.modal || ps.modal.title !== m.title) && this.modalInRef.current) { const el = this.modalInRef.current; el.focus(); if (m.kind === 'prompt') { const d = el.value.lastIndexOf('.'); el.setSelectionRange(0, d > 0 ? d : el.value.length); } }
}
openSearch() { this.setState(s => ({ menu: null, search: { ...s.search, open: true } })); this.later(() => { const el = this.searchRef.current; if (el) { el.focus(); el.select(); } }, 30); }
openNote() { this.setState(s => ({ menu: null, modal: { kind: 'note', title: 'Note', input: s.note, confirm: 'Save', key: '⌘↵', onConfirm: v => { this.setState({ note: v }); this.toast(v.trim() ? 'Note saved' : 'Note cleared'); } } })); this.later(() => this.modalInRef.current && this.modalInRef.current.focus(), 30); }
confirmModal() { const m = this.state.modal; if (!m) return; this.setState({ modal: null }); m.onConfirm && m.onConfirm(m.input); }
togglePanel(k) { this.setState(s => ({ panels: { ...s.panels, [k]: !s.panels[k] } })); }
// ---------- render ----------
renderVals() {
const s = this.state, F = s.files, BR = s.BR;
const fs = (this.props.fontSize || 14), lh = Math.round(fs * 1.6);
const changed = this.changed(F);
const stagedP = changed.filter(p => s.staged.includes(p)), unstagedP = changed.filter(p => !s.staged.includes(p));
const letterCol = (st, staged) => st === 'D' || st === 'M' && !staged ? '#F0B476' : '#8FBFB4';
const groupRows = (paths, staged) => {
const by = {}; paths.forEach(p => { (by[this.dir(p)] = by[this.dir(p)] || []).push(p); });
const rows = [];
Object.keys(by).sort().forEach(d => {
rows.push({ isDir: true, isFile: false, label: d || 'odynt' });
by[d].forEach(p => { const st = this.status(p, F), sel = s.selected === p, e = this.ext(p);
rows.push({ isDir: false, isFile: true, name: this.base(p), ext: e, badgeBg: this.badge(e), letter: st === 'A' ? (staged ? 'A' : 'U') : st, letterColor: letterCol(st, staged),
bg: sel ? '#232C39' : 'transparent', bar: sel ? '#E8913A' : 'transparent', color: sel ? '#F4F5F4' : '#BAC0C0', deco: st === 'D' ? 'line-through' : 'none',
actionIcon: staged ? 'minus' : 'plus', actionTitle: staged ? 'Unstage' : 'Stage',
onAction: ev => { ev.stopPropagation(); staged ? this.unstage(p) : this.stage(p); },
onClick: () => { this.setState({ selected: p }); st === 'D' ? this.openDiff(p) : this.open(p); },
onMenu: ev => this.openMenu(ev, p, this.fileItems(p, false)) }); });
});
return rows;
};
// tree
const live = Object.keys(F).filter(p => F[p].content !== null);
const dirs = new Set(s.emptyDirs);
live.concat(s.emptyDirs).forEach(p => { const parts = p.split('/'); for (let i = 1; i < parts.length; i++) dirs.add(parts.slice(0, i).join('/')); });
const changedDirs = new Set(); changed.forEach(p => { const parts = p.split('/'); for (let i = 1; i < parts.length; i++) changedDirs.add(parts.slice(0, i).join('/')); });
const kids = d => {
const pre = d ? d + '/' : '', ds = new Set(), fl = [];
dirs.forEach(x => { if (x.startsWith(pre) && x !== d && !x.slice(pre.length).includes('/')) ds.add(x); });
live.forEach(p => { if (this.dir(p) === d) fl.push(p); });
const cmp = (a, b) => this.base(a).toLowerCase().localeCompare(this.base(b).toLowerCase());
return [...[...ds].sort(cmp).map(p => ({ p, dir: true })), ...fl.sort(cmp).map(p => ({ p, dir: false }))].filter(k => s.hidden || !this.base(k.p).startsWith('.'));
};
const treeRows = [];
const walk = (d, depth) => {
kids(d).forEach(k => {
const open = k.dir && s.expanded.includes(k.p), sel = s.selected === k.p || (!k.dir && s.current === k.p && s.selected === k.p);
const st = k.dir ? '' : this.status(k.p, F), e = this.ext(k.p), hid = this.base(k.p).startsWith('.');
treeRows.push({ key: k.p, path: k.p, name: this.base(k.p), isDir: k.dir, isFile: !k.dir, isEmpty: false,
pad: (16 + depth * 18 - (sel ? 2 : 0)) + 'px', bg: sel ? '#232C39' : 'transparent', bar: sel ? '#E8913A' : 'transparent',
color: hid ? '#828D9A' : (sel || open ? '#F4F5F4' : (k.dir && changedDirs.has(k.p) ? '#F0B476' : '#BAC0C0')), weight: sel ? 600 : 400,
chev: open ? 'chevron-down' : 'chevron-right', chevColor: open ? '#E8913A' : '#6C7783', folderIcon: open ? 'folder-open' : 'folder',
ext: e, badgeBg: this.badge(e), letter: st === 'A' ? (s.staged.includes(k.p) ? 'A' : 'U') : st, letterColor: letterCol(st, s.staged.includes(k.p)),
onClick: () => k.dir ? this.setState(x => ({ selected: k.p, expanded: x.expanded.includes(k.p) ? x.expanded.filter(y => y !== k.p) : [...x.expanded, k.p] })) : this.open(k.p),
onMenu: ev => { this.setState({ selected: k.p }); this.openMenu(ev, null, k.dir ? this.dirItems(k.p) : this.fileItems(k.p, true)); } });
if (open) { const before = treeRows.length; walk(k.p, depth + 1); if (treeRows.length === before) treeRows.push({ key: k.p + '/~', path: k.p, name: '', isDir: false, isFile: false, isEmpty: true, pad: (16 + (depth + 1) * 18 + 20) + 'px', bg: 'transparent', bar: 'transparent', color: '#6C7783', weight: 400, letter: '', letterColor: 'transparent', onClick: () => {}, onMenu: ev => this.openMenu(ev, null, this.dirItems(k.p)) }); }
});
};
walk('', 0);
// editor
const cur = s.current && F[s.current] && F[s.current].content !== null ? s.current : null;
const text = cur ? F[cur].content : '';
const e = cur ? this.ext(cur) : '—';
const mk = cur ? this.marks(cur) : {};
const L = this.lines(text);
const gutterRows = L.map((_, i) => ({ n: i + 1, mark: mk[i] || 'transparent', band: mk[i] === '#8FBFB4' ? 'rgba(143,191,180,.13)' : (mk[i] ? 'rgba(232,145,58,.13)' : 'transparent'), color: mk[i] || (i + 1 === s.ln ? '#BAC0C0' : '#3A424C') }));
const isMd = e === 'md', curSt = cur ? this.status(cur) : '';
const previewBlocks = [];
if (s.view === 'preview' && isMd) L.forEach((ln, i) => {
if (!ln.trim()) return;
const first = previewBlocks.length === 0;
if (ln.startsWith('# ')) previewBlocks.push({ segs: this.segs(ln.slice(2)), font: "700 24px/1.2 'IBM Plex Mono',monospace", color: '#F4F5F4', mt: first ? '0' : '18px', isBullet: false });
else if (ln.startsWith('## ')) previewBlocks.push({ segs: this.segs(ln.slice(3)), font: "700 15px/1.3 'IBM Plex Mono',monospace", color: '#F4F5F4', mt: '18px', isBullet: false });
else if (ln.startsWith('- ')) previewBlocks.push({ segs: this.segs(ln.slice(2)), font: "400 15px/1.6 'IBM Plex Sans',sans-serif", color: '#BAC0C0', mt: '0', isBullet: true });
else previewBlocks.push({ segs: this.segs(ln), font: "400 15px/1.6 'IBM Plex Sans',sans-serif", color: '#BAC0C0', mt: '0', isBullet: false });
});
const parts = cur ? cur.split('/') : [];
const crumbDir = parts.length > 2 ? parts[0] + ' › … ›' : (parts.length === 2 ? parts[0] + ' ›' : '');
// claude items
const claudeItems = s.entries.map((en, idx) => {
const b = { isUser: false, isText: false, isTool: false, isMeta: false, key: idx };
if (en.kind === 'user') return { ...b, isUser: true, text: en.text };
if (en.kind === 'meta') return { ...b, isMeta: true, text: en.text };
if (en.kind === 'tool') return { ...b, isTool: true, tool: en.tool, arg: en.arg, cursor: en.path ? 'pointer' : 'default', onClick: () => en.path && this.open(en.path),
detail: (en.detail || []).map((d, j) => ({ lead: j === 0 ? '⎿' : '', t: d.t, color: d.c || '#828D9A', bg: d.bg || 'transparent' })) };
const lines = en.text.split('\n').map(ln => {
const head = /^\*\*[^*]+\*\*$/.test(ln.trim());
const li = /^(- |\d+\. )/.exec(ln);
return { segs: this.segs(ln).map(sg => ({ ...sg, color: sg.color === 'inherit' ? (head ? '#F4F5F4' : '#BAC0C0') : sg.color })), minH: ln ? '0' : '10px', pad: li ? '2ch' : '0', indent: li ? -li[0].length + 'ch' : '0' };
});
return { ...b, isText: true, lines };
});
const spinChars = ['·', '✢', '✳', '✶', '✻', '✽'];
// search
const q = s.search.q, ql = q.toLowerCase();
const allExts = [...new Set(live.map(p => this.ext(p)))].filter(x => x !== '·').sort();
const extOk = p => !s.search.exts.length || s.search.exts.includes(this.ext(p));
const visible = live.filter(p => (s.hidden || !p.split('/').some(x => x.startsWith('.'))) && extOk(p));
const hl = (line, idx, len) => ({ a: line.slice(Math.max(0, idx - 40), idx).replace(/^\s+/, ''), m: line.slice(idx, idx + len), b: line.slice(idx + len, idx + len + 120) });
let hits = 0; const projGroups = [];
if (ql) visible.forEach(p => {
const ls = this.lines(F[p].content), m = [];
ls.forEach((ln, i) => { const ix = ln.toLowerCase().indexOf(ql); if (ix >= 0) m.push({ n: i + 1, ...hl(ln, ix, q.length), onClick: () => { this.setState(x => ({ search: { ...x.search, open: false } })); this.open(p, i + 1); } }); });
if (m.length) { hits += m.length; const ex = this.ext(p); projGroups.push({ path: p, ext: ex, badgeBg: this.badge(ex), count: m.length, lines: m.slice(0, 5), onClick: m[0].onClick }); }
});
const hereRows = ql && cur ? (projGroups.find(g => g.path === cur) || { lines: [] }).lines : [];
const fileHits = ql ? visible.filter(p => this.base(p).toLowerCase().includes(ql)).map(p => { const nm = this.base(p), ix = nm.toLowerCase().indexOf(ql), ex = this.ext(p); return { ext: ex, badgeBg: this.badge(ex), a: nm.slice(0, ix), m: nm.slice(ix, ix + q.length), b: nm.slice(ix + q.length), dir: this.dir(p) + '/', onClick: () => { this.setState(x => ({ search: { ...x.search, open: false } })); this.open(p); } }; }) : [];
// diff
const dp = s.diffPath, dfile = dp ? F[dp] : null;
const diffRows = [];
if (dfile) {
const a = this.lines(dfile.orig), bL = this.lines(dfile.content), ops = this.diffOps(a, bL);
let dels = [], adds = [];
const flush = () => { const n = Math.max(dels.length, adds.length); for (let k = 0; k < n; k++) { const dl = dels[k], ad = adds[k];
diffRows.push({ ln: dl ? dl.i + 1 : '', lt: dl ? a[dl.i] : '', lbg: dl ? 'rgba(232,145,58,.12)' : 'rgba(35,44,57,.35)', lbar: dl ? '#E8913A' : 'transparent', lnc: dl ? '#F0B476' : '#3A424C',
rn: ad ? ad.j + 1 : '', rt: ad ? bL[ad.j] : '', rbg: ad ? 'rgba(143,191,180,.12)' : 'rgba(35,44,57,.35)', rbar: ad ? '#8FBFB4' : 'transparent', rnc: ad ? '#8FBFB4' : '#3A424C' }); } dels = []; adds = []; };
ops.forEach(o => { if (o.t === '-') dels.push(o); else if (o.t === '+') adds.push(o); else { flush(); diffRows.push({ ln: o.i + 1, lt: a[o.i], lbg: 'transparent', lbar: 'transparent', lnc: '#3A424C', rn: o.j + 1, rt: bL[o.j], rbg: 'transparent', rbar: 'transparent', rnc: '#3A424C' }); } });
flush();
}
const dst = dp ? this.stats(dp) : { a: 0, d: 0 };
const dStatus = dp ? ({ M: 'modified', A: 'new file', D: 'deleted', '': 'unchanged' })[this.status(dp)] : '';
let tA = 0, tD = 0; changed.forEach(p => { const x = this.stats(p); tA += x.a; tD += x.d; });
const m = s.modal, menu = s.menu;
const btn = (label, on, onClick, i, extra) => ({ label, title: extra, onClick, bg: on ? 'rgba(232,145,58,.10)' : 'transparent', color: on ? '#F4F5F4' : '#828D9A', dot: on ? '#E8913A' : '#3A424C', border: i ? '1px solid #232C39' : 'none' });
const P = s.panels;
const showTerminal = this.props.showTerminal ?? true;
const gst = p => this.status(p, F);
const gCat = { changed: unstagedP.filter(p => gst(p) === 'M'), new: unstagedP.filter(p => gst(p) === 'A'), deleted: unstagedP.filter(p => gst(p) === 'D'), staged: stagedP };
const GC = { M: '#F0B476', A: '#8FBFB4', D: '#C3A6CE' };
const SC = { changed: GC.M, new: GC.A, deleted: GC.D, staged: '#E8913A' };
const TC = { changed: 'rgba(240,180,118,.06)', new: 'rgba(143,191,180,.06)', deleted: 'rgba(195,166,206,.06)', staged: 'rgba(232,145,58,.08)' };
const gPad = arr => arr.length < 2 ? [{ isGap: true, isBtn: false }, ...arr] : arr;
const gBtn = (label, fn, warn) => ({ isBtn: true, isGap: false, label, color: warn ? '#F0B476' : '#BAC0C0', onClick: ev => { ev.stopPropagation(); fn(); } });
const gDefs = [
{ k: 'staged', label: 'staged', bulk: ps => [gBtn('Unstage all', () => this.gUnstage(ps))], row: p => [gBtn('Unstage', () => this.gUnstage([p]))]},
{ k: 'changed', label: 'changed', bulk: ps => [gBtn('Discard all', () => this.gDiscard(ps), 1), gBtn('Stage all', () => this.gStage(ps))], row: p => [gBtn('Discard', () => this.gDiscard([p]), 1), gBtn('Stage', () => this.gStage([p]))] },
{ k: 'new', label: 'new · untracked', bulk: ps => [gBtn('Delete all', () => this.gDiscard(ps), 1), gBtn('Stage all', () => this.gStage(ps))], row: p => [gBtn('Delete', () => this.gDiscard([p]), 1), gBtn('Stage', () => this.gStage([p]))] },
{ k: 'deleted', label: 'deleted', bulk: ps => [gBtn('Restore all', () => this.gDiscard(ps)), gBtn('Stage all', () => this.gStage(ps))], row: p => [gBtn('Restore', () => this.gDiscard([p])), gBtn('Stage', () => this.gStage([p]))] },
];
const gitSections = gDefs.filter(d => gCat[d.k].length).map((d, i) => {
const ps = gCat[d.k], open = s.gitSec[d.k] !== false, sep = i === 1 && gCat.staged.length > 0;
const files = ps.map(p => { const key = d.k + ':' + p, fo = s.gitOpenFiles.includes(key), st = gst(p), x = this.stats(p);
return { key, dir: this.dir(p) ? this.dir(p) + '/' : '', name: this.base(p), letter: st, letterColor: GC[st], statusName: ({ M: 'Modified', A: 'New file', D: 'Deleted' })[st], bar: d.k === 'staged' ? '#E8913A' : 'transparent', nameColor: st === 'D' ? '#828D9A' : '#F4F5F4', deco: st === 'D' ? 'line-through' : 'none',
add: '+' + x.a, del: '−' + x.d, open: fo, chev: fo ? 'chevron-down' : 'chevron-right', chevColor: fo ? '#E8913A' : '#6C7783', bg: fo ? '#18202B' : 'transparent',
actions: gPad(d.row(p)), rows: fo ? this.gitRows(p) : [],
onToggle: () => this.setState(y => ({ gitOpenFiles: y.gitOpenFiles.includes(key) ? y.gitOpenFiles.filter(z => z !== key) : [...y.gitOpenFiles, key] })),
onMenu: ev => this.openMenu(ev, p, this.gitFileItems(p)) }; });
return { key: d.k, label: d.label, count: ps.length, countBg: SC[d.k], color: SC[d.k], tint: TC[d.k], open, chev: open ? 'chevron-down' : 'chevron-right', chevColor: open ? '#E8913A' : '#6C7783',
mt: sep ? '28px' : '0', topRule: sep ? '#232C39' : 'transparent', actions: gPad(d.bulk(ps)), files, onToggle: () => this.setState(y => ({ gitSec: { ...y.gitSec, [d.k]: !open } })) };
});
const dirty = changed.length;
const brItem = (name, remote) => { const cur = !remote && name === s.BR, can = !cur && !dirty, tracked = remote && s.branches.includes(name);
return { name: remote ? 'origin/' + name : name, icon: cur ? 'git-branch' : (remote ? 'cloud' : 'git-branch'), iconColor: cur ? '#E8913A' : '#6C7783',
bar: cur ? '#E8913A' : 'transparent', bg: cur ? 'rgba(232,145,58,.08)' : 'transparent', color: cur ? '#F4F5F4' : '#BAC0C0', weight: cur ? 600 : 400,
meta: cur ? 'current' : (tracked ? 'tracked' : ''), action: can && !(remote && tracked && name === s.BR) ? (remote && !tracked ? 'checkout →' : 'switch →') : '',
cursor: cur ? 'default' : (dirty ? 'not-allowed' : 'pointer'), opacity: cur || !dirty ? 1 : 0.4,
title: cur ? 'Current branch' : (dirty ? 'Commit or discard your changes first' : 'Switch to ' + name),
onClick: () => { if (cur) return; if (dirty) { this.toast('— Commit or discard ' + dirty + (dirty === 1 ? ' file' : ' files') + ' before you switch.'); return; } this.gSwitch(name, remote); } }; };
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 {
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',
pullCount: s.behind ? '↓' + s.behind : '', pushCount: s.ahead ? '↑' + s.ahead : '',
syncLabel: s.ahead || s.behind ? [s.ahead ? s.ahead + ' ahead' : '', s.behind ? s.behind + ' behind' : ''].filter(Boolean).join(' · ') + ' origin' : 'in sync with origin',
gitMsgRef: this.gitMsgRef, onGitMsg: ev => this.setState({ commitMsg: ev.target.value }),
onGitMsgKey: ev => { if (ev.key === 'Enter' && (ev.metaKey || ev.ctrlKey)) { ev.preventDefault(); this.gCommit(false); } },
gitCommit: () => this.gCommit(false),
gitCommitMenu: ev => this.openMenu(ev, null, [{ label: 'Commit', icon: 'check', run: () => this.gCommit(false) }, { label: 'Commit and push', icon: 'arrow-up-from-line', bold: true, run: () => this.gCommit(true) }]),
gCommitBg: gReady ? '#E8913A' : '#232C39', gCommitColor: gReady ? '#101720' : '#828D9A',
gCommitLabel: stagedP.length ? 'Commit ' + stagedP.length + (stagedP.length === 1 ? ' file' : ' files') : 'Nothing staged',
gitClean: !changed.length, gitSections,
glogRef: this.glogRef, glogLines: s.glog.map(l => ({ t: l.t, color: l.c })), gitInRef: this.gitInRef, gInput: s.gInput,
onGInput: ev => this.setState({ gInput: ev.target.value }),
onGKey: ev => { if (ev.key === 'Enter') this.gRun(s.gInput); else if (ev.key === 'ArrowUp' && s.gHist.length) { ev.preventDefault(); this.setState({ gInput: s.gHist[s.gHist.length - 1] }); } },
focusGitIn: ev => { if (ev.target.tagName !== 'BUTTON' && !window.getSelection().toString()) this.gitInRef.current && this.gitInRef.current.focus(); },
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')],
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 }) },
{ label: 'Hidden', key: '⌘.', title: 'Show hidden files', hasDot: true, dot: s.hidden ? '#E8913A' : '#3A424C', color: s.hidden ? '#F4F5F4' : '#828D9A', bg: s.hidden ? 'rgba(232,145,58,.10)' : 'transparent', keyColor: s.hidden ? '#E8913A' : '#6C7783', border: '1px solid #232C39', onClick: () => this.setState({ hidden: !s.hidden }) },
{ 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' }],
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,
stagedRows: groupRows(stagedP, true), changeRows: groupRows(unstagedP, false), stageAll: () => this.stageAll(),
hasCommits: s.commits.length > 0, commitRows: s.commits.slice(0, 5),
commitMsg: s.commitMsg, onCommitMsg: ev => this.setState({ commitMsg: ev.target.value }),
onCommitKey: ev => { if (ev.key === 'Enter' && ev.shiftKey) { ev.preventDefault(); this.commit(); } },
commit: () => this.commit(), commitBg: stagedP.length ? '#E8913A' : '#232C39', commitColor: stagedP.length ? '#101720' : '#6C7783',
push: () => this.push(), pushColor: s.ahead ? '#E8913A' : '#828D9A', aheadLabel: s.ahead ? String(s.ahead) : '', pushTitle: s.ahead ? 'Push ' + s.ahead + ' commit(s)' : 'Push',
treeRows, newRootFile: () => this.newFile(''), collapseAll: () => this.setState({ expanded: [] }),
fileExt: e, fileBadgeBg: this.badge(e), filePath: cur || 'No file open', fileDirty: !!curSt,
togglePreview: () => isMd ? this.setState({ view: s.view === 'preview' ? 'edit' : 'preview' }) : this.toast('— Preview is for Markdown files.'),
previewLabel: s.view === 'preview' && isMd ? 'Edit' : 'Preview', previewBg: s.view === 'preview' && isMd ? 'rgba(232,145,58,.10)' : 'transparent', previewColor: s.view === 'preview' && isMd ? '#F4F5F4' : '#BAC0C0', previewOpacity: isMd ? 1 : 0.4,
openDiffCurrent: () => cur && curSt ? this.openDiff(cur) : this.toast('— No changes in this file.'), diffOpacity: curSt ? 1 : 0.4,
isEdit: !(s.view === 'preview' && isMd), isPreview: s.view === 'preview' && isMd, previewBlocks,
showGutter: !s.fluid, gutterRows, lineH: lh + 'px', fontSize: fs + 'px',
editorText: text, taRef: this.taRef, wrapAttr: s.fluid ? 'soft' : 'off', taWhite: s.fluid ? 'pre-wrap' : 'pre',
taWidth: s.fluid ? '100%' : 'auto', taMinW: s.fluid ? '0' : '100%', taHeight: s.fluid ? 'auto' : (L.length * lh + 58) + 'px',
onEdit: ev => { if (!cur) return; const v = ev.target.value; this.setFiles(Fs => { Fs[cur] = { orig: Fs[cur].orig, content: v }; }); },
onCaret: ev => { const t = ev.target, b = t.value.slice(0, t.selectionStart).split('\n'); this.setState({ ln: b.length, col: b[b.length - 1].length + 1 }); },
onEditorMenu: this.onEditorMenu,
claudeItems, running: s.running, spinText: spinChars[s.spin % spinChars.length] + ' ' + s.verb + '…',
transcriptRef: this.transcriptRef, claudeRef: this.claudeRef, claudeInput: s.claudeInput,
claudePlaceholder: s.running ? 'Claude is working — Esc interrupts' : 'Ask Claude, or right-click a file to pass it on',
onClaudeInput: ev => this.setState({ claudeInput: ev.target.value }),
onClaudeKey: ev => { if (ev.key === 'Enter' && !ev.shiftKey) { ev.preventDefault(); this.send(s.claudeInput); } else if (ev.key === 'Tab' && ev.shiftKey) { ev.preventDefault(); this.setState({ mode: (s.mode + 1) % 4 }); } },
sendClaude: () => this.send(s.claudeInput), sendColor: s.claudeInput.trim() ? '#E8913A' : '#3A424C',
cycleMode: () => this.setState({ mode: (s.mode + 1) % 4 }),
modeLabel: ['auto mode on', 'plan mode on', 'accept edits on', 'default mode'][s.mode], modeColor: s.mode === 3 ? '#828D9A' : '#E8913A',
contextLabel: Math.min(99, 18 + s.entries.length * 2) + '% context used',
showTerminal, termRef: this.termRef, termInRef: this.termInRef,
termLines: s.term.map(l => ({ t: l.p ? '$ ' + l.t : l.t, color: l.p ? '#F4F5F4' : l.c })),
termPrompt: '[' + (BR.split('/')[1] || BR).slice(0, 14) + '…][~/code/odynt]$', termInput: s.termInput,
onTermInput: ev => this.setState({ termInput: ev.target.value }),
onTermKey: ev => { if (ev.key === 'Enter') this.term(s.termInput); else if (ev.key === 'ArrowUp' && s.history.length) { ev.preventDefault(); this.setState({ termInput: s.history[s.history.length - 1] }); } },
focusTerm: ev => { if (ev.target.tagName !== 'BUTTON' && !window.getSelection().toString()) this.termInRef.current && this.termInRef.current.focus(); },
clearTerm: ev => { ev.stopPropagation(); this.setState({ term: [] }); },
statusAdd: tA, statusDel: tD, statusCounts: stagedP.length + ' staged · ' + unstagedP.length + ' unstaged' + (s.ahead ? ' · ↑' + s.ahead : ''), ln: s.ln, col: s.col, lang: this.lang(e),
searchOpen: s.search.open, searchRef: this.searchRef, searchQ: q,
onSearchQ: ev => { const v = ev.target.value; this.setState(x => ({ search: { ...x.search, q: v } })); },
onSearchKey: ev => { if (ev.key === 'Enter') { const f = projGroups[0] || null; if (f) f.onClick(); else if (fileHits[0]) fileHits[0].onClick(); } },
extChips: allExts.map(x => { const on = s.search.exts.includes(x); return { ext: x, bg: on ? '#E8913A' : 'transparent', color: on ? '#101720' : '#BAC0C0', border: on ? '#E8913A' : '#3A424C', onClick: () => this.setState(st => ({ search: { ...st.search, exts: on ? st.search.exts.filter(y => y !== x) : [...st.search.exts, x] } })) }; }),
searchSummary: hereRows.length + ' here · ' + hits + ' hits · ' + projGroups.length + ' files',
hereRows, hereEmpty: !hereRows.length, projGroups, projCount: hits, projEmpty: !projGroups.length, projEmptyText: ql ? '— Nothing matches "' + q + '".' : 'Type to search every file in odynt.',
fileHits, fileHitCount: fileHits.length, closeSearch: () => this.setState(x => ({ search: { ...x.search, open: false } })), stop: ev => ev.stopPropagation(),
diffOpen: !!dfile, diffRows, diffPath: dp || '', diffExt: dp ? this.ext(dp) : '', diffBadgeBg: dp ? this.badge(this.ext(dp)) : '#BAC0C0', diffAdd: dst.a, diffDel: dst.d, diffStatus: dStatus, diffSame: !!dfile && !this.status(dp),
closeDiff: () => this.setState({ diffPath: null }),
stageDiff: () => { if (!dp) return; if (s.staged.includes(dp)) this.unstage(dp); else this.stage(dp); },
diffStageLabel: dp && s.staged.includes(dp) ? 'Unstage' : 'Stage',
discardDiff: () => dp && this.status(dp) ? this.confirmDiscard(dp) : this.toast('— Nothing to discard.'),
menuOpen: !!menu, menuX: menu ? menu.x + 'px' : '0', menuY: menu ? menu.y + 'px' : '0', menuTitle: menu && menu.title ? menu.title : '', menuHasTitle: !!(menu && menu.title),
menuItems: menu ? menu.items.map(it => ({ label: it.label, icon: it.icon, sep: !!it.sep, color: it.danger ? '#E8913A' : (it.bold ? '#F4F5F4' : '#BAC0C0'), iconColor: it.danger ? '#E8913A' : '#828D9A', weight: it.bold ? 600 : 400, onClick: () => { this.setState({ menu: null }); it.run(); } })) : [],
closeMenu: () => this.setState({ menu: null }), closeMenuCtx: ev => { ev.preventDefault(); this.setState({ menu: null }); },
modalOpen: !!m, modalTitle: m ? m.title : '', modalBody: m && m.body ? m.body : '', modalHasBody: !!(m && m.body),
isPrompt: !!m && m.kind === 'prompt', isNote: !!m && m.kind === 'note', isHelp: !!m && m.kind === 'help', modalHasCancel: !(m && m.noCancel),
modalInput: m && m.input != null ? m.input : '', modalInRef: this.modalInRef,
onModalInput: ev => { const v = ev.target.value; this.setState(x => ({ modal: { ...x.modal, input: v } })); },
onModalKey: ev => { if (ev.key === 'Enter' && (m.kind === 'prompt' || ev.metaKey || ev.ctrlKey)) { ev.preventDefault(); this.confirmModal(); } },
modalConfirm: () => this.confirmModal(), modalCancel: () => this.setState({ modal: null }),
modalConfirmLabel: m ? m.confirm : '', modalConfirmKey: m && m.key ? m.key : '↵',
toastOpen: !!s.toast, toastText: s.toast || ''
};
}
}
</script>
</body>
</html>