>_EXECUTIVE SUMMARY
zpwr-file-browser is the shared multi-pane file browser of the MenkeTechnologies GUI stack — a host-agnostic vanilla-JS front end plus a pure-Rust filesystem crate, both extracted from Audio-Haxor so every app browses files from one source of truth. The front end is loaded as a classic script and calls a fixed set of invoke names on the host IPC object (window.zfbHost); each host supplies the filesystem backend.
The Rust crate ships those backend operations as 34 pure pub async fn functions (faithfully ported, no Tauri types), so it builds Tauri-free by default. Enabling the tauri cargo feature additively compiles 35 thin #[tauri::command] wrappers — one per pure fn, plus the fb_watcher_set watcher command — each named with the exact invoke name the front end expects. A parallel capi feature compiles the ffi module, exposing the same surface to non-Tauri (JUCE) hosts through the staticlib C ABI entry fb_invoke.
~ARCHITECTURE
One front end, one backend contract. The vanilla-JS browser is host-agnostic; the Rust crate provides the filesystem operations either natively (pure fns) or via the tauri-feature command wrappers. The directory watcher core is framework-agnostic and always compiled.
| Layer | Implementation |
|---|---|
| Front end | webui/file-browser.js (5,359 lines) + file-browser.css + the #tabFiles markup; multi-pane, sortable + resizable columns, fzf filter with matched-char highlight, color labels, tree sidebar, context menu, text/hex/image quicklook + preview pane, git status |
| Backend contract | the front end calls fixed invoke names on window.zfbHost.*; each method returns a Promise; unsupported optional capabilities resolve to a neutral value (never throw) so rows/previews degrade gracefully |
| Pure Rust core | crate/src/lib.rs — 34 pub async fn filesystem functions returning Result<T, String>, no Tauri types; ported verbatim from Audio-Haxor's command bodies with the Tauri layer stripped |
| Tauri command layer | crate/src/commands.rs — 35 thin #[tauri::command] wrappers (each awaits its pure counterpart), compiled only under the additive tauri feature; param names mirror the pure fns so Tauri's camelCase→snake_case arg mapping resolves |
| C ABI layer | crate/src/ffi.rs — the staticlib C ABI for non-Tauri (JUCE) hosts, compiled under the additive capi feature; one entry fb_invoke(cmd, args_json) dispatches by name into the pure fns and returns a JSON envelope, with fb_string_free to release results |
| Watcher | crate/src/fb_watcher.rs — framework-agnostic WatcherSession; notify-based, non-recursive, 300 ms-debounced single-directory watch; canonicalizes the path and hands it back; always compiled (no Tauri/JUCE types) |
| Build | Cargo crate-type = ["rlib", "staticlib"], publish = false; cargo build (no features) stays Tauri-free; --features tauri adds the command layer; --features capi adds the staticlib C ABI |
&FILESYSTEM SURFACE
34 pure functions in lib.rs, mirrored by 35 command wrappers in commands.rs (the extra wrapper is fb_watcher_set). Grouped by role:
| Group | Functions |
|---|---|
| List / inspect | fs_list_dir · fs_list_subdirs · fs_get_info · fs_folder_size · fs_disk_usage · fs_xattrs · fs_git_status |
| Create / modify | fs_create_dir · fs_create_file · fs_touch · fs_copy_path · fs_duplicate · fs_make_alias · fs_chmod · fs_symlink_retarget · rename_file |
| Delete | delete_file · move_to_trash · fs_secure_delete |
| Read / preview | fs_read_head · fs_read_head_bytes · fs_read_file_base64 · fs_write_file_base64 · fs_read_file_bytes |
| Search / compare | fs_grep · fs_find_duplicates · fs_compare_dirs · fs_diff · fs_hash |
| Archive | fs_compress (zip) · fs_extract (.zip / .tar / .tar.gz / .tgz / .7z) |
| Open / run | fs_open_in_editor · fs_open_terminal · fs_run_program |
| Watch (command-only) | fb_watcher_set — wraps fb_watcher::WatcherSession; emits file-browser-change with { "dir": canonical } |
Return types serialize as camelCase JSON via serde: FsInfo, FsHashResult, GrepMatch, DiskUsage, DirCompareResult, DiffOp, DuplicateGroup, XattrEntry, FolderWalkResult. Unix-only operations (fs_chmod, fs_xattrs, fs_symlink_retarget, fs_run_program) compile a cfg(not(unix)) fallback that returns an error or empty result.
/DIRECTORY WATCHER
WatcherSession is a single-directory, non-recursive, notify-based watcher with a 300 ms debounce (bursty operations collapse into one reload). watch(dir, on_change) stops any prior watch, canonicalizes dir, starts watching, and fires the injected on_change(canonical) callback on each debounced change; stop() drops the watcher (idempotent). The core pulls in no Tauri or JUCE types — the framework wiring lives in the tauri-feature fb_watcher_set command, which emits AppHandle::emit("file-browser-change", { "dir": canonical }) — the exact event and payload the front end consumes.
$DEPENDENCIES
16 direct dependencies in [dependencies], plus xattr under the cfg(unix) target. tauri and futures are optional (pulled in only by the tauri and capi features respectively).
| Dependency | Role |
|---|---|
serde / serde_json | return-type serialization (camelCase JSON; preserve_order) |
chrono | mtime / ctime formatting in directory listings |
sha2 | SHA-256 for fs_hash, dedup and dir-compare fingerprints |
base64 | base64 file reads for image quicklook (fs_read_file_base64) |
similar | Myers / Patience text diff for fs_diff |
zip / tar / flate2 / sevenz-rust2 | archive read + write (.zip, .tar, .tar.gz/.tgz, .7z) |
filetime | cross-platform atime/mtime set for fs_touch |
sysinfo | disk total/free for fs_disk_usage |
trash | OS trash (recoverable delete) for move_to_trash |
notify | filesystem watcher backend (FSEvents / inotify, poll fallback) |
xattr (unix) | extended attributes for fs_xattrs |
tauri (optional) | command layer — only compiled under the tauri feature |
futures (optional) | minimal block_on executor driving the sync-bodied fs_* fns from the C ABI — only compiled under the capi feature |
+CI GATES
| Gate | Command |
|---|---|
| fmt | cargo fmt --all --check |
| clippy | cargo clippy --all-targets -- -D warnings |
| doc | RUSTDOCFLAGS=-D warnings cargo doc --no-deps |
| test | cargo test --verbose (headless; the watcher tests scan temp dirs) |
The umbrella MenkeTechnologiesMeta repo additionally pins this component's metadata across its gate suite — LICENSE present + canonical MIT text, authors field, and the house docs gates that this report and the docs page satisfy.
#PROJECT METADATA
| Item | Value |
|---|---|
| Version | 0.1.0 |
| License | MIT |
| Crate type | rlib + staticlib C ABI (publish = false); tauri and capi features additive |
| Rust source | 4 files, 2,226 lines (lib.rs, commands.rs, fb_watcher.rs, ffi.rs) |
| Front end | file-browser.js (5,359), file-browser.css (1,876), file-browser.html (168) |
| Hosts | Audio-Haxor, traderview, ztranslator (Tauri), zpwr-daw (JUCE) |
| Author | MenkeTechnologies |
| Repository | github.com/MenkeTechnologies/zpwr-file-browser |
| Meta umbrella | MenkeTechnologiesMeta |