openeditorcode.devFIELD MANUAL / 0.2.41Español
architecture.md DOCUMENTATION

18 — Under the hood

Editor architecture

Startup, capability-based composition, state, infrastructure and dependencies.

v0.2.41Source review ·
On this page

Stack and startup

Strict TypeScript, Bun and OpenTUI Solid. Solid organizes reactive state and components; OpenTUI renders the terminal workbench. The product has no server. The reviewed lock uses OpenTUI 0.5.1 and Prettier 3.9.6.

CLI resolves help/version before UI/config. The binary enters through bootstrap/executable.ts, supervises a worker and marks the first frame healthy. index.tsx loads configuration, resolves root, creates the renderer and composes App.

Execution and composition flowtext
npm alias → launcher → platform binary → supervisor → worker
                                            ↓
CLI → configuration + root → renderer → App
                                      ├─ useWorkbench
                                      └─ AppLayout
                                         ├─ Explorer
                                         ├─ Documents / Editor / Preview / Diff
                                         ├─ Git
                                         └─ Overlays

Capability map

DirectoryResponsibility
workbench/Composition, capability wiring and single keyboard router.
documents/Tabs, dirty state, guarded I/O, saving, previews and concurrent opening.
editor/Textarea, cursor, history, local find, metrics, syntax, clipboard and formatting.
explorer/ + search/Tree, rules, reused index, project search and temporary exclusions.
git/Git commands, state, history, navigation, trees and diffs.
dialogs/Overlay state and keyboard-capturing confirmations.
config/ + bootstrap/Validation, defaults, persistence, recovery and startup.
logs/ + localization/ + updates/ + docs/Session log, language, version check and embedded manual.

Design invariants

  • App composes; useWorkbench connects through callbacks; panes receive props rather than importing other capabilities to execute actions.
  • useKeyboardShortcuts owns key priority. Without filePath there is no dirty document. The buffer is synchronized before changing tabs.
  • Capability infrastructure does not depend on the renderer. File helpers centralize reading/writing. OpenTUI stays in UI and adapters.
  • Generations prevent stale openings; history uses abort and pinned revisions; deferred highlighting checks generation/path/content. Not all async operations share that protection.

External dependencies

Git runs as a process, ignore interprets rules, Prettier formats, and system tools provide clipboard access. Binaries include the Bun runtime; Node/npm are only required for the npm channel. External formatters are registered globally.

Chapter sources

Links pinned to the reviewed commit; they do not follow main.

Static documentation · ES / ENView coverage ↗