before the great git rework
This commit is contained in:
@@ -18,13 +18,13 @@ Helder (executable) → HelderUI → HelderServices → HelderCore
|
||||
|
||||
## How a window works
|
||||
|
||||
- `WorkspaceModel` owns one window (`WorkspaceModel.swift`: state and `perform`; `+Commands`, `+ContextActions`, `+Lifecycle`, `+Refresh` hold the rest): the stores (`SourceControlStore`, `ExplorerStore`, `EditorStore`, `NoteStore`, `CleanCopyStore`, `TerminalStore`, `LayoutStore`, `OverlayStore`, `ToastStore`, `ReadAloudStore`) and every action that spans more than one of them. A store never reaches into a sibling; `EditorStore` only reads the git state through a closure.
|
||||
- **One entry point.** Views, the menu bar and the key router all call `WorkspaceModel.perform(Command)` (`Shell/Command.swift`). Context-menu items arrive as `.context(ContextAction)`; the model asks `SourceControlStore.confirmation(for:)` / `ExplorerStore.confirmation(for:)` first and shows the confirm overlay, and `.confirmPending` runs the action. The name prompt submits with `.submitName`, the pass-on prompt with `.passToAgent`, the note's ⌘P with `.passNote`.
|
||||
- **Overlays never stack.** `OverlayStore.current` is one `Overlay` enum; only the model presents or dismisses it. `OverlayStore.onChange` lets the model run closing behaviour however an overlay went away (the note saves, the Diff gives back the mode it covered). `OverlayHost` draws the current overlay. `.launcher` is the ⇧⌘O "Open recent project" list; the bare window's launcher is part of the shell, not an overlay. The key router only sees `OverlayKind` (`none`, `note`, `diff(busy:)`, `other`): over the Diff the workspace keys keep working unless its own menu or prompt is open (`busy`). Toasts (`ToastStore`) may sit on top. The Diff draws its own right-click menu and pass-on prompt inside itself, so it stays open.
|
||||
- `WorkspaceModel` owns one window (`WorkspaceModel.swift`: state and `perform`; `+Commands`, `+ContextActions`, `+Lifecycle`, `+Refresh` hold the rest): the stores (`SourceControlStore`, `ExplorerStore`, `EditorStore`, `CleanCopyStore`, `TerminalStore`, `LayoutStore`, `OverlayStore`, `ToastStore`, `ReadAloudStore`) and every action that spans more than one of them. A store never reaches into a sibling; `EditorStore` only reads the git state through a closure.
|
||||
- **One entry point.** Views, the menu bar and the key router all call `WorkspaceModel.perform(Command)` (`Shell/Command.swift`). Context-menu items arrive as `.context(ContextAction)`; the model asks `SourceControlStore.confirmation(for:)` / `ExplorerStore.confirmation(for:)` first and shows the confirm overlay, and `.confirmPending` runs the action. The name prompt submits with `.submitName`, the pass-on prompt with `.passToAgent`.
|
||||
- **Overlays never stack.** `OverlayStore.current` is one `Overlay` enum; only the model presents or dismisses it. `OverlayStore.onChange` lets the model run closing behaviour however an overlay went away (the Diff gives back the mode it covered). `OverlayHost` draws the current overlay. `.launcher` is the ⇧⌘O "Open recent project" list; the bare window's launcher is part of the shell, not an overlay. The key router only sees `OverlayKind` (`none`, `diff(busy:)`, `other`): over the Diff the workspace keys keep working unless its own menu or prompt is open (`busy`). Toasts (`ToastStore`) may sit on top. The Diff draws its own right-click menu and pass-on prompt inside itself, so it stays open.
|
||||
- **Read aloud.** `.readAloudFile` reads the open file's buffer (unsaved edits included) or the file from disk, turns it into prose with `MarkdownSpeech`, and hands it to `ReadAloudStore`; `.readAloudText` speaks the selection (selected Markdown as prose). `ReadAloudStore` lives as long as the window, like `ToastStore`; its `isReading` shows the title bar's Stop, which runs `.stopReading`. `closeProject()` stops the reading.
|
||||
- **Stores report, the model shows.** Stores raise toasts through `notify`/`showToast` hooks the model wires to `ToastStore`; the model never toasts a second time for the same action.
|
||||
- **Closing.** A window close, a project switch and ⌘Q all run `prepareToClose()` first: every unsaved file (at most the open one plus a vanished-file buffer) is asked about, and a cancel keeps everything open. Then `closeProject()` waits for running work, writes the note and session and ends the terminals.
|
||||
- **Lifecycle.** `start()`: recents → config (applied to every store and the terminals) → git, tree, note and the `.clean-copy` baseline in parallel → `editor.restore` → watcher → git polling (`git.refreshInterval`) → the PHP class list 1.5 s later. Watcher events: `.cleanCopy` (`.clean-copy` in the root, 150 ms debounce, fired besides `.project`) makes `CleanCopyStore` re-read the file and opens the `.cleanCopy` overlay for new non-blank text (the text found at load is the baseline; another open overlay makes it wait, keeping only the newest); `.project` re-reads git, the tree, the open file and every unsaved buffer (the edits kept), invalidates the symbol index and reloads the class list 2 s after the last change; `.git` re-reads git; `.config` re-resolves and re-applies the config. ⌘R re-reads git and the tree and lets the disk win in the open file. A project switch or window close saves the note and the session, stops the watcher and polling, and ends both terminals.
|
||||
- **Closing.** A window close, a project switch and ⌘Q all run `prepareToClose()` first: every unsaved file (at most the open one plus a vanished-file buffer) is asked about, and a cancel keeps everything open. Then `closeProject()` waits for running work, writes the session and ends the terminals.
|
||||
- **Lifecycle.** `start()`: recents → config (applied to every store and the terminals) → git, tree and the `.clean-copy` baseline in parallel → `editor.restore` → watcher → git polling (`git.refreshInterval`) → the PHP class list 1.5 s later. Watcher events: `.cleanCopy` (`.clean-copy` in the root, 150 ms debounce, fired besides `.project`) makes `CleanCopyStore` re-read the file and opens the `.cleanCopy` overlay for new non-blank text (the text found at load is the baseline; another open overlay makes it wait, keeping only the newest); `.project` re-reads git, the tree, the open file and every unsaved buffer (the edits kept), invalidates the symbol index and reloads the class list 2 s after the last change; `.git` re-reads git; `.config` re-resolves and re-applies the config. ⌘R re-reads git and the tree and lets the disk win in the open file. A project switch or window close saves the session, stops the watcher and polling, and ends both terminals.
|
||||
- **Terminals.** `TerminalStore` owns both panes' handles. Ending a pane goes through the store (`terminateAll`, `restart`, or `release` when a pane's window closes), which signals the child and lets `ChildReaper` collect it, so no zombie or orphan is left. A pane whose child exited restarts on the next key press. Right-click raises `contextMenuRequested`; the model shows the app's own menu (`.terminal` target: Copy with a selection, Paste). Font size follows `layout.textScale` (⌘0/⌘+/⌘−) live.
|
||||
- **Git and files.** Git gets paths as literal pathspecs (`GIT_LITERAL_PATHSPECS=1`, so `pages/[id].vue` is one file). A changed file over `FileLimits.maxDiffFileBytes` (1 MB) keeps its row but loads no text: `GitFileChange.isTooBig` → `Diff.isTooBig`, and the Diff shows "Too big.". Saves are atomic (temp file, then rename, keeping permissions). Writes, creates, renames and deletes are refused when the entry's folder resolves (symlinks included) outside the project (`containedURL`). The watcher drops `IgnoreRules.walkIgnoredNames`, framework caches (`storage/framework/`, `bootstrap/cache/`, `.phpunit*`) and `files.exclude`.
|
||||
- **Processes.** Every new window (⇧⌘N, the Dock's New Window, Open Folder or Open Recent with no key window) is a new Helder process via `SystemActing.openNewInstance`: `NSWorkspace` with `createsNewApplicationInstance` in the bundle, `InstanceLauncher` (Foundation `Process`) under `swift run`. The folder travels as `-HelderProject <path>`, which `ProjectLocator.initialRoot` reads as its directory argument; a bare path could reach AppKit as a file to open. Switching projects (⌘O, Open Recent in a window) stays in the process. `AppName` renames the process to the project's title (the launcher is "Helder"), so Mission Control, the Dock and ⌘Tab tell projects apart. Windows are not restorable and `NSQuitAlwaysKeepsWindows` is off, so a launch opens exactly one window.
|
||||
@@ -50,7 +50,7 @@ Sources/HelderServices/
|
||||
Git/ GitServicing, GitService, GitDirectory (worktrees)
|
||||
Logging/ Log (unified log) + FileLogger (~/Library/Logs/Helder/helder.log)
|
||||
Process/ ProcessRunner, ExecutableLocator, ChildReaper, InstanceLauncher
|
||||
Project/ ConfigService, NotesService, RecentStores, SessionStore, ProjectLocator
|
||||
Project/ ConfigService, RecentStores, SessionStore, ProjectLocator
|
||||
Search/ SearchServicing + RipgrepSearchService, ProjectScanner (rg, or a Swift walk)
|
||||
Speech/ SpeechServicing + SpeechService (AVSpeechSynthesizer, the system voice), shared by the window
|
||||
Symbols/ SymbolService
|
||||
@@ -65,7 +65,7 @@ Sources/HelderUI/
|
||||
Explorer/ the file tree column and the row glyphs
|
||||
Editor/ the bar above the code, code/markdown/image panes, Diff overlay, pass-on panel, symbol popup
|
||||
Terminal/ agent + shell panes over SwiftTerm
|
||||
Overlays/ OverlayHost, search, note and clean copy (sharing OverlayTextEditor), shortcuts, recent files, context menu, name prompt, confirm, OverlayKeys
|
||||
Overlays/ OverlayHost, search, clean copy (OverlayTextEditor), shortcuts, recent files, context menu, name prompt, confirm, OverlayKeys
|
||||
Theme/ Palette, Typography, Metrics, FontRegistry
|
||||
Resources/Fonts/ IBM Plex Mono 400–700, Plex Sans 400/500/600/700/400i (WOFF2, OFL)
|
||||
Tests/<Target>Tests/<same folders>/
|
||||
@@ -102,7 +102,7 @@ How the suites are organised and how to run one: see the Testing section of the
|
||||
- **ripgrep** is not on this machine's `PATH`. `bundle.sh` copies `$RG_BINARY`, else `vendor/ripgrep/rg`, else an `rg` on `PATH` into `Contents/Helpers/rg`, which `ExecutableLocator.standard` checks first. `$RG_BINARY` overrides it at runtime; the tests use it, else `vendor/ripgrep/rg`. Without any rg, search, the file list and the symbol index fall back to a Swift walk (slower, same results).
|
||||
- **Own data.** The recent-projects list (`~/Library/Application Support/Helder/recent-projects.json`, read by ⇧⌘O and the launcher) and the log (`~/Library/Logs/Helder/helder.log`) belong to this app alone. Running it on a scratch folder adds that folder to the list; remove it afterwards. Under `swift run` the UserDefaults domain is `Helder` (sessions, layouts), in the bundle `nl.blijnder.helder`.
|
||||
- **`bundle.sh --install`** refuses to replace a `~/Applications/Helder.app` with a different bundle id without `--force`.
|
||||
- **⌘N** is the note, so "New Window" is ⇧⌘N. New Window starts a new process on the launcher, and the child never inherits `HELDER_PROJECT` (it would win over the folder argument). ⌘A is select-all in the focused view (in the code pane, the whole file); fluid columns are ⌘L.
|
||||
- **⌘N** is unbound; "New Window" is ⇧⌘N. New Window starts a new process on the launcher, and the child never inherits `HELDER_PROJECT` (it would win over the folder argument). ⌘A is select-all in the focused view (in the code pane, the whole file); fluid columns are ⌘L.
|
||||
- **Config.** `files.followGitignore` defaults to **false** (the main-process value). There is no CSS layer: code font and size come from config/Typography.
|
||||
- **One file, no Original.** The editor deliberately has no tabs and no Original mode. `git.defaultDiffMode: "original"` in an older config decodes as `"updated"`.
|
||||
- **SwiftTerm** has no line-height or letter-spacing setting, so `terminal.lineHeight`/`letterSpacing` from the config are ignored.
|
||||
|
||||
Reference in New Issue
Block a user