C2: lutra CLI in the setup with optional PATH entry, xtask bundle prints the version
Some checks failed
ci / ci (macos-15) (push) Has been cancelled
ci / ci (ubuntu-24.04) (push) Has been cancelled
ci / ci (windows-2025) (push) Has been cancelled

- xtask bundle builds lutra-cli and adds it as a Tauri external binary
  through a --config override (lutra.exe next to the app on Windows,
  Lutra.app/Contents/MacOS/lutra on macOS); prints path, version, size.
- NSIS: "Add lutra to PATH" page, unticked by default, /ADDTOPATH for
  silent installs. Changes HKCU\Environment Path only, keeps its type,
  broadcasts WM_SETTINGCHANGE, records the entry; the uninstaller removes
  exactly that entry. A PATH too long for NSIS strings is left alone.
- lutra CLI resolves a symlinked executable before looking for the app.
- localStorage: the UI never used webview storage, so there is nothing to
  migrate; docs corrected, ESLint now bans localStorage, sessionStorage
  and indexedDB, with tests.
- docs/install.md: CLI, PATH, macOS link step, webview folder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-11-01 12:46:49 +01:00
parent d8e66a4652
commit 0a4b80adec
7 changed files with 628 additions and 46 deletions

View file

@ -20,8 +20,13 @@
//! `settings.json` goes straight into the new config directory, never
//! replacing one that is already there.
//!
//! The webview's own data (recent projects, window layout) lives in a
//! folder the webview manages and is not copied.
//! The webview's own folder (WebView2's `EBWebView` under
//! `%LOCALAPPDATA%\<identifier>`, WKWebView's under `~/Library/WebKit/`)
//! is not copied: it holds only the webview's caches. The frontend keeps
//! no state in `localStorage`, `sessionStorage` or IndexedDB (the UI lint
//! forbids them), so nothing the user set lives there. State that has to
//! survive a restart belongs in Lutra's own files above, which this
//! migration carries over.
use std::fs;
use std::io;
@ -300,6 +305,36 @@ mod tests {
assert!(new.data_dir.join("recovery/p1/e1.json").is_file());
}
#[test]
fn an_empty_settings_object_is_copied_too() {
let tmp = tempfile::tempdir().unwrap();
let old = shared(tmp.path(), rendezvous::LEGACY_APP_IDENTIFIER);
let new = shared(tmp.path(), rendezvous::APP_IDENTIFIER);
fs::create_dir_all(old.data_dir.join("recovery")).unwrap();
fs::create_dir_all(old.data_dir.join("tools")).unwrap();
fs::write(old.config_dir.join("settings.json"), "{}").unwrap();
let migrated = migrate(&old, &new).unwrap().unwrap();
assert_eq!(migrated.entries, ["settings.json", "recovery", "tools"]);
assert_eq!(
fs::read_to_string(new.config_dir.join("settings.json")).unwrap(),
"{}"
);
assert!(new.data_dir.join("recovery").is_dir());
assert!(new.data_dir.join("tools").is_dir());
}
#[test]
fn the_ui_lint_keeps_state_out_of_the_webview_storage() {
let lint = include_str!("../../../ui/eslint.config.js");
for rule in ["no-restricted-globals", "no-restricted-properties"] {
assert!(lint.contains(rule), "{rule} missing");
}
for name in ["\"localStorage\"", "\"sessionStorage\"", "\"indexedDB\""] {
assert!(lint.contains(name), "{name} not banned");
}
}
#[test]
fn the_tauri_config_uses_the_app_identifier() {
let conf: serde_json::Value =