feat: add Tauri state persistence and BvCli trait
- Add Tauri storage adapter for Zustand (tauri-storage.ts) - Add read_state, write_state, clear_state Tauri commands - Wire focus-store and nav-store to use Tauri persistence - Add BvCli trait for bv CLI mocking with response types - Add BvError and McError conversion for bv errors - Add cleanup_tmp_files tests for bridge - Fix linter-introduced tauri_specta::command issues Closes bd-2x6, bd-gil, bd-3px Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -15,6 +15,7 @@ use tauri::menu::{MenuBuilder, MenuItemBuilder};
|
||||
use tauri::tray::TrayIconBuilder;
|
||||
use tauri::{Emitter, Manager};
|
||||
use tauri_plugin_global_shortcut::{Code, GlobalShortcutExt, Modifiers, Shortcut, ShortcutState};
|
||||
use tauri_specta::{collect_commands, Builder};
|
||||
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
|
||||
|
||||
/// Toggle the main window's visibility.
|
||||
@@ -101,6 +102,28 @@ pub fn run() {
|
||||
|
||||
tracing::info!("Starting Mission Control");
|
||||
|
||||
// Build tauri-specta builder for type-safe IPC
|
||||
let builder = Builder::<tauri::Wry>::new().commands(collect_commands![
|
||||
commands::greet,
|
||||
commands::get_lore_status,
|
||||
commands::get_bridge_status,
|
||||
commands::sync_now,
|
||||
commands::reconcile,
|
||||
commands::quick_capture,
|
||||
commands::read_state,
|
||||
commands::write_state,
|
||||
commands::clear_state,
|
||||
]);
|
||||
|
||||
// Export TypeScript bindings in debug builds
|
||||
#[cfg(debug_assertions)]
|
||||
builder
|
||||
.export(
|
||||
specta_typescript::Typescript::default(),
|
||||
"../src/lib/bindings.ts",
|
||||
)
|
||||
.expect("Failed to export TypeScript bindings");
|
||||
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_shell::init())
|
||||
.plugin(
|
||||
@@ -165,14 +188,7 @@ pub fn run() {
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
commands::greet,
|
||||
commands::get_lore_status,
|
||||
commands::get_bridge_status,
|
||||
commands::sync_now,
|
||||
commands::reconcile,
|
||||
commands::quick_capture,
|
||||
])
|
||||
.invoke_handler(builder.invoke_handler())
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user