feat: add write-directories settings with native picker - #150
Conversation
Adds get_write_dirs/set_write_dirs Tauri commands that manage the [relay] write_dirs array in ~/.endara/config.toml, preserving sibling keys and de-duplicating entries, plus a Settings 'Write directories' section with list/remove and a native directory picker. Changes are persisted then pushed to the running relay via reloadConfig().
panghy
left a comment
There was a problem hiding this comment.
Reviewed with focus on config persistence, path handling, Svelte/TS quality, test coverage, and indentation. Verdict: APPROVED — no blocking issues. (Posted as a comment review because GitHub does not allow approving one's own PR; the reviewing agent shares the author's credentials.)
Verification run locally on the branch:
pnpm vitest run src/lib/components/Settings.test.ts→ 47/47 passcargo test write_dirs_tests→ 9/9 passcargo fmt --check→ cleanpnpm check(svelte-check) → 0 errors (1 pre-existing unrelatednodetypes warning)
What I verified:
- Persistence:
set_write_dirspreserves unrelated[desktop]/[relay]/[[endpoints]]content (covered byset_write_dirs_preserves_other_fields), creates a missing[relay]section with amachine_nameso the relay'sRelayConfigdeserialization won't break, and the keyrelay.write_dirsmatches the relay'sConfigfield exactly. - Duplicates: deduped in both layers — frontend no-op in
addWriteDir, first-seen-order dedup inset_write_dirs— with tests on both sides. - Absolute paths: input is picker-only (no free-text), and the relay independently validates/canonicalizes; see inline note.
- Patterns/conventions:
writeDirsUi.tsmirrorstoonOutputUi.ts(Tauri read path avoids the relay-socket race; optimistic write + revert), the test module mirrorstoon_output_tests(HomeGuard +#[serial]), and 2-space indentation is respected in the Svelte/TS changes (Rust stays on rustfmt formatting, gated bycargo fmt --check). - Lockfile commit (db632b8): only syncs the already-declared
@tanstack/svelte-virtualdependency intopnpm-lock.yaml; no version changes to anything else.
Three non-blocking inline notes below.
There was a problem hiding this comment.
Pull request overview
Adds a new “Write directories” setting to the desktop app, letting users manage the relay sandbox write_dirs allowlist from Settings via a native folder picker, persisted to ~/.endara/config.toml and applied to the running relay via config reload.
Changes:
- Added UI/store helpers to fetch/persist
write_dirsthrough Tauri commands and trigger relay config reloads. - Updated Settings UI to display/manage the allowlist and open the native folder picker.
- Added/registered new Tauri commands to read/write
relay.write_dirsand added Rust/UI unit tests; updatedpnpm-lock.yaml.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/writeDirsUi.ts | New UI helper module to fetch/persist write_dirs via Tauri + reload relay config |
| src/lib/stores.ts | Adds writeDirs Svelte store for the allowlist |
| src/lib/components/Settings.test.ts | Adds helper-level unit tests for write dirs UI logic |
| src/lib/components/Settings.svelte | Adds “Write directories” section and native folder picker integration |
| src-tauri/src/lib.rs | Adds get_write_dirs/set_write_dirs commands, config read/write helpers, and Rust tests |
| pnpm-lock.yaml | Lockfile sync for declared dependencies |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Address PR review feedback: fail fast at the Tauri boundary when a write_dirs entry is empty or relative instead of persisting a value the relay would later reject, and de-duplicate read_write_dirs output (first-seen order) so hand-edited duplicate entries cannot produce duplicate keys in the UI's keyed each-list.
Summary
Adds a "Write directories" setting to the desktop app so users can manage the relay sandbox's
write_dirsallowlist from the UI, with a native folder picker.User-visible behavior:
writeFilecalls are allowed to write into.write_dirsarray, so the relay picks it up as its write allowlist. An empty list means sandbox writes stay disabled (opt-in only).Safety / UI behavior
Linear
END-21 — add writeFile so tool media can reach the filesystem.
Commits