Commit graph

21 commits

Author SHA1 Message Date
danny
bd225d9e3a B1: alpha installers (NSIS, DMG), identifier com.tyrveil.lutra with data migration
- App identifier com.tyrveil.lutra (D26) in tauri.conf.json and
  rendezvous::APP_IDENTIFIER; a test keeps them equal.
- First normal start copies settings.json, recovery/ and tools/ once from
  the dev.lutra.desktop directories (staging dir + rename, logged, info
  notification); old directories stay untouched.
- Bundling on: per-user NSIS setup (English, German, Start menu, optional
  desktop shortcut, uninstaller) and DMG; `cargo xtask bundle` builds the
  platform's installer, joining the DMG backgrounds into a HiDPI TIFF on
  macOS. build.rs also writes icons/512x512.png for the .icns.
- Installer images from the banner, designed by Amy, generated by
  `cargo xtask installer-images` (assets/installer/, ASSETS.md rows);
  approved by Daniel.
- docs/install.md (SmartScreen, Gatekeeper, uninstall, data locations),
  README install section, architecture, development and macOS notes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 21:48:15 +01:00
danny
93a4076b86 PM: merge A3 part 2: blame without path, plural messages, screenshot path hardening
Some checks are pending
ci / ci (macos-15) (push) Waiting to run
ci / ci (ubuntu-24.04) (push) Waiting to run
ci / ci (windows-2025) (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 20:57:30 +01:00
danny
3c80ab87c9 A3: ui.screenshot answers with the absolute path and checks the file
A relative path is resolved against the app's working directory before
the capture, and the answer names that absolute path, so a file written
elsewhere than expected is visible. After writing, the file is read back
and a missing or short file is an error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 14:58:36 +01:00
danny
1bf69ded55 A1: macOS readiness: setup guide, cargo xtask mac-report, unix/macOS fixes
- docs/macos.md: step-by-step setup for a fresh Apple Silicon Mac (Xcode
  CLT, Homebrew, git, PHP, Composer, Node 22, pnpm, rustup, clone from
  Forgejo), the machine report, Gatekeeper notes, macOS differences and
  what Windows cannot check.
- cargo xtask mac-report: versions, the gate steps, the bundled-UI desktop
  build and a self-check over the control channel (project, file,
  Phpactor, hover, git.status, terminal, screenshot, quit); every step
  times out and runs in a lutra_proc group; one report.md to send back.
- Fixes: macOS native menu (system menus only; Cmd+W stays buffer.close,
  Cmd+Q runs app.quit), xcap screenshot region in points on macOS
  (Retina), login shell (-l, /bin/zsh fallback) and LANG for the
  terminal on macOS, PHP lookup in Homebrew/MacPorts dirs for Finder
  starts, case-insensitive LSP path mapping on macOS, rendezvous file
  mode re-set to 0600, CLI-started desktop in its own process group.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 14:47:45 +01:00
danny
01ec7605bd F2b: explain screenshot timeouts (blocked main thread or hidden page)
A WebView2 capture that does not arrive within 10 s now says whether the
main thread never ran the request or WebView2 accepted it without drawing
a frame; in the latter case the page's document.visibilityState is read
and a hidden page is reported with its likely causes (locked session,
display asleep, minimised, other virtual desktop). Docs record that a
--control instance started from the foreground app's process tree can
still take the foreground at start (open, F2c).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 17:48:42 +01:00
danny
d097558ba5 M4.10: remotes: fetch, pull, push, clone and manage remotes
Owner decision D23: Lutra runs fetch, pull (merge or rebase per the new
git.pull.mode setting), push (upstream set on the first push) and clone
through the user's git. Any HTTPS or SSH server works; sign-in stays with
git's credential helper (its own window is allowed for network calls only)
and the ssh agent. Terminal prompts stay off, ext:: is refused, and URL
userinfo is redacted in every message, progress line and remote listing.

- vcs: Call::network with a 30 min timeout, a stderr progress sink and a
  Cancel flag that kills git's process group; remote.rs with clone_repo,
  fetch, pull, push (--porcelain rejections), remotes and add/set-url/
  remove; explained refusals (rejected push, sign-in, host key, not found,
  unreachable, no upstream, local changes, conflicts).
- engine: git.fetch/pull/push/clone/cancel/remotes/remoteAdd/remoteSetUrl/
  remoteRemove, one network call at a time, gitProgress events,
  gitChanged after changes.
- ui: status-bar progress with Cancel and ahead/behind, vcs.fetch/pull/
  push/clone/manageRemotes (Git menu, no default shortcuts), Clone
  Repository and Manage Remotes dialogs; desktop pick_dir IPC.
- Tests against local bare repositories only (vcs 8, engine 3, Vitest 11)
  plus unit and property tests; docs updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 17:50:26 +01:00
danny
f49b42836a F2: ui.screenshot captures the webview without focusing the window
On Windows the webview renders itself into a PNG through WebView2
CapturePreview (scheduled on the main thread via with_webview, 10 s
timeout, PNG signature and 64 MiB cap checked). macOS and Linux keep the
xcap screen-region capture as a documented fallback, now without focusing.
app.focus is the only control method that changes focus. A --control
instance opens its window without taking the foreground. An ignored live
test samples the foreground window while the app starts and takes five
screenshots and fails if Lutra ever owns it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 17:13:38 +01:00
danny
9801a346b6 H5: banner-aligned themes, diagnostic and VCS tokens
Both themes follow the README banner without taking it over: calm,
near-neutral surfaces (cream-tinted light, faintly plum-tinted dark),
the raspberry only as the accent, retuned syntax colours and the
terminal on the editor surface. Approved by the owner from before/after
screenshots.

New tokens `--lt-diag-error|warning|info|hint` (lint underlines, gutter,
tooltips, Problems icons) and `--lt-vcs-added|modified|deleted|untracked|
ignored|conflicted` (for M4.4), listed in `theme::DIAGNOSTIC_TOKENS` and
`theme::VCS_TOKENS`. Completion kind icons take the syntax colour of
their kind. The contrast test checks every new colour (4.5:1 text,
3:1 icons) in both themes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 13:58:38 +01:00
danny
e969f6497c PM: merge H4 string and path settings controls, live assist settings
Some checks are pending
ci / ci (macos-15) (push) Waiting to run
ci / ci (ubuntu-24.04) (push) Waiting to run
ci / ci (windows-2025) (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 13:20:26 +01:00
danny
197d5b7d27 H4: string and path settings controls, live completion and tooltip settings
- Settings dialog: every string setting gets a text field with in-place
  hints (quotes or spaces around a path, control characters, length);
  keys ending in path/executable also get "Browse…" through the dialog
  plugin's native picker (new desktop IPC pick_file). git.executable
  from M4.1 gets the control without UI changes.
- settings.open {section?, query?} for agents and live checks.
- New keys editor.completion.autoPopup, editor.completion.delayMs and
  editor.hover.delayMs; the assist module reads them live through
  CodeMirror compartments.
- Tests: engine settings test, control/engine key lists, Vitest for the
  controls and the live wiring. Docs: architecture, ui-parity, parity
  Settings row, gaps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 13:10:39 +01:00
danny
ba70b0f43a H6: isolated data directory for dev and live-check instances
`--data-dir DIR` / `LUTRA_DATA_DIR` move settings, the recovery journal,
the rendezvous file and the WebView2 user data folder into one directory.
`--control PORT` without either uses `<temp>/lutra-control/<port>/`. The
SHA-256-checked Phpactor cache stays shared from the user's data dir
(`Engine::share_tools_from`). An isolated instance never forwards to or
registers as the user's main instance; `rendezvous::dir()` honours
`LUTRA_DATA_DIR` after `LUTRA_RENDEZVOUS_DIR`, so the CLI finds it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 13:03:37 +01:00
danny
578160a2ba M3.5: go to definition, find references and rename through Phpactor
Engine (`cmd/lsp_nav.rs`, on the pending outcomes of 20d1d28):
- `lsp.definition` (F12) and `lsp.references` (Shift+F12, sorted, with
  line previews) return project-relative locations; locations outside
  the project, such as PHAR stubs and symlink escapes, are dropped.
- `lsp.prepareRename` uses the word at the cursor when the server has
  no prepareProvider.
- `lsp.rename` (F2) applies the workspace edit (`lsp_nav/edit.rs`):
  1. Check everything first: inside the project, ranges fit (UTF-16,
     CRLF), open buffers unchanged since the request, no file
     operations, no incomplete edit.
  2. Write closed files atomically through the VFS, restoring earlier
     writes when a later one fails.
  3. Change open buffers through `buffer.edit` (dirty, undoable).
  4. Send each written file to Phpactor as didOpen/didSave/didClose
     plus didChangeWatchedFiles; without this its index kept the old
     names. Then the summary notification `notification.lsp.renamed`.

UI (`components/editor/nav/`):
- Mod+click goes to the definition, with a pointer cursor while Mod is
  held.
- A location picker for several definitions (exclusive modal).
- A References tab in the bottom panel, grouped by file.
- An inline rename field with a use/file count (exclusive modal).
- `BufferSync.beginUndoableRemote` puts the engine's rename edit into
  the editor history as one undo step per buffer.
- Catalog strings and tokens only.

Fake LSP server: `--script FILE` with scripted capabilities and
answers (additive next to M3.4's arms).

Tests:
- `crates/engine/tests/lsp_nav.rs` (fake): definition; bad positions;
  references; prepareRename; a multi-file rename incl. a closed CRLF
  file; refusals for outside the project, a bad range, a stale buffer,
  bad names and no server.
- The ignored real-Phpactor test covers definition, references and a
  rename and back across 3 files.
- Vitest `ui/tests/nav/`.

Live (Phpactor 2026.06.25.0, Windows, port 7935, tick on):
- definition 93 ms cold / 7-18 ms warm
- references ~140 ms
- prepareRename ~11 ms
- rename 28-59 ms
- index follows written files in 140 ms
- Phpactor 57 MB working set, ~1.6% of a core while ticking idle

Gate: 13 steps, 197 s, Vitest 484 + 1 skipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:50:15 +02:00
danny
20d1d28c32 M3.5: pending outcomes for commands that wait for the language server
Step 1 of M3.5: the shared mechanism. M3.4 and M3.5 build on it.

- Engine: `Outcome.pending: Option<Pending>`. `Pending::new(rx, timeout,
  finish)`; `Pending::wait()` is called without the engine lock and
  returns at the answer, a dropped sender or the deadline (timeout + 1 s).
  `Engine::resolve(answered)` then runs `finish(state, reply)` inside the
  guard, under the lock. `run_waiting(lock, cmd, params, publish)` does
  all three steps for hosts.
- Hosts: `Host::run`, `testkit::EngineBackend` and the control test
  backend use `run_waiting`.
- New IPC `engine_execute_waiting` (`#[tauri::command(async)]`, off the
  main thread) with `runWaiting()` in `ui/src/ipc.ts`. Only `lsp.*`
  requests use it.

Ordering guarantee:
- `engine_execute` stays synchronous on the main thread, so ordinary
  commands (`buffer.edit`) still run in call order.
- The order towards the server is fixed under the engine lock:
  `buffer.edit` queues its didChange on the session's FIFO queue before
  it returns, and `lsp::submit` queues the request on the same queue.
  A request therefore sees every edit whose `buffer.edit` returned
  first, and the UI awaits the sync's `idle()` before sending one.

Failures:
- A stall is caught by the request timeout, with the deadline as
  backstop.
- On restart, close, quit or crash the request is dropped or resolved
  as stopped, so the waiter gets an error, never a hang.

Tests: `crates/engine/tests/pending.rs` (answer, lock free while
waiting, dropped sender, deadline, resolve, lsp.restart while a
request is pending) and Vitest for `runWaiting`. Gate: 13 steps,
321 s, Vitest 443 + 1 skipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 06:36:20 +02:00
danny
50f36cce8b M3.1: PHP detection and pinned Phpactor download
- crates/lsp toolchain: PHP from php.executable or PATH, `php -v` with a
  5 s timeout and capped output, version parsing (proptest), PHP >= 8.2.
- Pinned Phpactor 2026.06.25.0 (SHA-256 832510fe...59e9); newer releases
  need ext-posix and do not start on Windows.
- Download with ureq + rustls (ring, OS roots via rustls-native-certs):
  HTTPS only, 32 MiB cap, SHA-256 verified before an atomic write, retry
  with backoff. Tests use a local HTTP server only.
- Engine: settings php.executable, phpactor.path, phpactor.autoDownload
  (bool and string setting kinds), toolchain.status,
  toolchain.downloadPhpactor, toolchainChanged, notifications; worker
  thread off the engine lock, results via the pump. Downloads only after
  the host calls Engine::allow_downloads (the desktop does).
- Docs: architecture Toolchain section (network access, D15), G6.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 11:30:57 +02:00
danny
9b278099cf M3.7: lutra CLI and single instance
- crates/control: rendezvous file (<data_dir>/instance.json, port + random
  token, atomic write, 0600 on Unix, stale detection), token-protected
  listener (start_with_token, app.auth first, constant-time compare,
  10 s auth timeout), app.focus, and a blocking client (connect_live,
  request/execute/subscribe/next_event, open_folder/open_file/reveal)
- lutra-desktop: a normal start forwards its path to a running instance
  and exits, otherwise claims the rendezvous; --control instances skip it
  unless LUTRA_RENDEZVOUS_DIR is set; non-Unicode args are usage errors
- lutra-cli (binary lutra, now L6): path[:line[:column]] targets, folder ->
  project.open, file -> file.open (parent opened without a project, outside
  the project refused), editor.reveal, starts the desktop if needed,
  --wait until bufferClosed, --version/--help, exit codes 0/1/2
- tests: proptest target parsing, rendezvous read/write/stale, token check
  over TCP, forwarding against a test backend, --wait end to end
- docs: architecture, G7, ROADMAP (agent automation 18% est.), roadmap,
  README

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 00:23:09 +02:00
danny
f41df518b5 M1.12: notifications as toasts
The host publishes picker, command-line and pump errors as notification
events (Engine::notify, same id sequence) instead of stderr, keeps
notifications and watchFailed published before engine_ready and replays
them after the state replay, so startup warnings (corrupt settings,
journal entries) reach the UI. ipc.ts announces engine_ready once all
subscriptions started together are registered.

Frontend: notifications store and NotificationStack (bottom right, info
auto-dismissed after 5 s, warnings/errors stay, close button and Escape,
at most 5 visible with "+n more", role status/alert); watchFailed maps to
a warning toast; failed commands without their own UI raise an error
toast. Catalog keys notification.settings.*, project.*, vfs.*, watch.*,
command.* plus the runtime allow-list. Docs updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 16:20:45 +02:00
danny
cde6e119c6 M1.10: light theme, live theme switching, editor tokens
- theme::LIGHT next to DARK with the 10 new tokens (editor selection,
  active line, cursor, gutter, match, font size, tab active/modified,
  notice); light fg-muted, accent and error darkened for WCAG AA
- theme.list, theme.systemPreference, themeChanged event when the
  resolved theme changes (settings.set/reset appearance.theme, or the
  OS preference in system mode)
- desktop init script and window background from the stored setting;
  system mode uses a prefers-color-scheme media query for the first frame
- ui/src/theme.ts applies tokens to :root and color-scheme live; editor,
  tabs and notice drop their var() fallbacks
- Vitest WCAG AA contrast check against a Rust-maintained snapshot,
  DOM tests, headless control-channel test
- docs: architecture Themes, parity rows, ui-parity, gaps, roadmaps

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 15:49:23 +02:00
danny
f9357ee4b5 M1.9a: engine dirs and settings backend
EngineConfig and Engine::with_config; the desktop resolves Tauri's app
config and data dirs. Settings model (appearance.theme, editor.fontSize,
ui.language) with typed validation, persistence in settings.json via
write_atomic (1 MiB cap, unknown keys kept, corrupt file backed up with a
warning notification), settings.list/get/set/reset, settingsChanged and
notification events. Property test over random settings.json content,
control-channel test for persistence and corrupt-file recovery.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 15:23:43 +02:00
danny
dd98636de4 M1.4: desktop bridge: engine events to the window, folder picker, live project tree
The desktop host publishes every engine event, from commands and from a
pump thread that calls Engine::pump_vfs every 100 ms, to control channel
subscribers and to the window as the Tauri event engine://event, in engine
order. ui/src/ipc.ts gets a typed onEngineEvent; its first subscription
calls engine_ready, and the host replays the current project and buffers,
so a project opened from the command line (lutra-desktop --control PORT
PATH) reaches the UI. project.openDialog returns Effect::PickFolder; the
host shows the native folder picker (tauri-plugin-dialog, licence checked)
and opens the choice, one picker at a time, cancel is not an error.
Capabilities shrink to event listen/unlisten.

Contract fix: the M1.5 project UI assumed shapes the engine does not use.
engineEvents.ts now translates engine events ({kind: projectOpened, ...})
and project.children results ({dir, entries, truncated}) into the UI types,
keeping role and truncated; the store maps listings through
toTreeEntries() and the project tests use the real engine shapes.

Verified in the running app on Windows 11: tree of a project given on the
command line, expanding src, a file created on disk appearing live, the
folder picker opening one dialog and opening the chosen folder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 06:41:49 +02:00
danny
f1976c7d67 M1.3: engine workspace, file and buffer commands, event stream
State holds the open project (VFS project, watcher, watched directories)
and versioned buffers. New commands: project.open/close/children,
file.open/save/saveAll, buffer.get/edit/close. buffer.edit takes UTF-16
change sets based on a version and fails with the new stale_version code;
closing dirty buffers or projects without force fails with
unsaved_changes. Commands queue events (projectOpened, treeChanged,
bufferChanged, dirtyChanged, fileChangedOnDisk, ...) that the engine
returns in Outcome.events; Engine::pump_vfs maps changes on disk to
events and reloads clean buffers. project.children watches listed
directories, capped at 256 native / 32 polling, least recently listed
dropped first.

Control channel: events.subscribe streams {"event": ...} lines, with
bounded per-subscriber queues (lutra_control::Subscribers) and method docs
in methods.rs. testkit's EngineBackend and the desktop Host implement the
new Backend::subscribe. Verified with 14 engine integration tests, a TCP
events test and the running app over the control channel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 20:24:44 +02:00
danny
55acb0dffb M0.5: Tauri desktop shell with themed main window
The window is built in setup with the theme tokens injected by an
initialization script and the background colour taken from the theme, so
the first frame is already themed. Frontend IPC (engine_execute,
engine_list_commands) and the control channel both run commands through
the Host, which applies effects such as Quit. ui.screenshot captures the
window's client area from the screen because xcap skips windows of its own
process. build.rs generates the placeholder icon into the gitignored
icons/ directory. Verified on Windows: window opens, ping, listCommands,
screenshot, app.quit, and exit status 1 when the control port is taken.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 18:39:49 +02:00