Automate Tauri command registration via tauri-helper.#3679
Conversation
There was a problem hiding this comment.
@divanshu-go can you remove unrelated change from the pr
generated by the screenpipe pr-review pipe (https://screenpi.pe), not written by a human — reply and tag @louis030195 if it got something wrong.
8c67e2e to
62f4a90
Compare
Replace manual handler and specta command lists with build-time auto-collection, add specta_bindings export/drift tests, and regenerate tauri.ts with stable ordering.
62f4a90 to
0422153
Compare
…better consistency. Change bigint types to number in various functions and types for improved compatibility across the codebase.
|
@louis030195 removed the unrelated changes from this PR. I also changed Specta’s bigint export from Typescript::default().bigint(BigIntExportBehavior::Number)Reason: Tauri IPC serializes through JSON, so the frontend receives JS The values we expose are safely below
Screen.Recording.2026-05-29.at.5.49.23.PM.mov
|
Screen.Recording.2026-05-29.at.6.25.57.PM.mov |
Resolve the lib/utils/tauri.ts conflict by regenerating the bindings against the merged Rust command surface. main added `display_preview: Option<String>` to `pi_queue_prompt`, so the regenerated `piQueuePrompt` binding now carries the 4th `displayPreview` argument. `bun run bindings:check` (tauri_bindings_are_current) passes and `next build` succeeds. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
main advanced while resolving the PR. Re-merge brings in the feat(export) meeting/range MP4 export plus the v2.4.294/295 bumps. Conflict was only in main.rs invoke_handler: main registered the new `meeting_export::export_recording` command in the manual generate_handler! list that this PR replaces with `tauri_helper::tauri_collect_commands!()`. Kept the macro and dropped the manual entry — `export_recording` is auto-collected (it has `#[tauri::command]`), and is correctly absent from tauri.ts since it has no `#[specta::specta]` (frontend calls it via raw invoke). Regenerated bindings (zero diff), drift test and `next build` pass, Cargo.lock synced to 2.4.295. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
@louis030195 I'm currently rebasing it , So I will ping you once its done. |
d350a8d to
e50ced5
Compare
… auto-collect - Resolve main.rs conflict in favor of main's tauri_collect_commands!() auto-collection (PR #3679) — drops the manual generate_handler! list. - Add #[specta::specta] to await_safe_restart so the auto-collector actually registers it (without it the command is silently excluded and the frontend raw invoke("await_safe_restart") would fail at runtime). get_boot_phase already had both attrs. - Cargo.lock: take main's superset (#3660 adds no deps). - Add crates/screenpipe-audio/examples/race_repro.rs: a standalone harness that reproduces the ORT teardown SIGSEGV (#3622) 40/40 in RACE mode and stays clean 40/40 in GATED mode (validating the boot-ready gate). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>


Description
Replaces hand-maintained Tauri invoke-handler and tauri-specta command lists with build-time auto-collection using tauri-helper at
65d4f27. Adds drift tests so checked-in TypeScript bindings stay in sync with Rust, and regenerateslib/utils/tauri.tswith stable alphabetical ordering.Motivation
The screenpipe Tauri app had grown to ~200 commands spread across many modules. Every new
#[tauri::command]required manual updates in three places:tauri::generate_handler![...]inmain.rstauri_specta::collect_commands![...]inmain.rslib/utils/tauri.tsMissing a step caused runtime handler errors or stale frontend types. This PR removes that maintenance burden and adds CI-friendly guards against binding drift.
Changes
Rust backend (
apps/screenpipe-app-tauri/src-tauri)tauri-helperas a git dependency (build + runtime) pinned to65d4f27build.rstauri_helper::generate_command_filewithcollect_all: trueto scan the workspace for all#[tauri::command]functions at compile timemain.rstauri_helper::specta_collect_commands!()andtauri_helper::tauri_collect_commands!()insteadmain.rsdefine_specta_builder!macro shared by debug export, tests, and the specta registryspecta_bindings.rspackage.jsonbindings:checkandbindings:generatebun scripts (wrappers around the drift tests below)Frontend (
apps/screenpipe-app-tauri)lib/utils/tauri.tsHow it works
At build time,
tauri-helperwalks the Cargo workspace, finds every function annotated with#[tauri::command], and writes generated macro input totarget/tauri_commands_list/. At compile time:specta_collect_commands!()expands to the fulltauri_specta::collect_commands![...]listtauri_collect_commands!()expands totauri::generate_handler![...]Adding a new command is now: write
#[tauri::command], rebuild — no list editing.Binding export & drift detection
From
apps/screenpipe-app-tauri/:Equivalent
cargo testinvocations (what the bun scripts call under the hood):In debug builds,
main.rsalso callswrite_bindings_if_changed_withon startup so local dev stays in sync without manual export.Test plan
cargo check -p screenpipe-appsucceeds with the pinnedtauri-helpergit dependencybun run bindings:checkpasses inapps/screenpipe-app-tauri(checked-intauri.tsmatches Rust)bun run typecheckpasses inapps/screenpipe-app-tauribun run buildcompletes (Next.js + pre_build)#[tauri::command]in a submodule and confirm it appears in the handler without editingmain.rsNotes
No behavior change intended — this is a registration and tooling refactor. Command names and signatures are unchanged; only how they are collected and exported differs.
Stable diffs —
tauri.tsreordering is cosmetic (alphabetical).