README: the optional command groups the host serves and what the app supplies for each

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
CRTkafa 2026-10-01 04:42:07 +07:00
parent 409949edb9
commit 8005b2f047
2 changed files with 26 additions and 9 deletions

View file

@ -147,14 +147,26 @@ The site's page is not trusted, and neither is a plugin. The rules:
- `waybetter privacy-scan` and `waybetter build-env` keep a build free of the builder's paths and - `waybetter privacy-scan` and `waybetter build-env` keep a build free of the builder's paths and
names; `waybetter release` refuses to release an artifact with a hit. names; `waybetter release` refuses to release an artifact with a hit.
## What is in the host and what is still yours ## Optional command groups
The host owns the logic for settings backup, encrypted folder sync, saved workspaces, the Beyond the commands every app gets, the host serves groups of shell-only commands that an app turns
developer-mode watcher, keyword alerts, the gallery and clipboard history, Google Fonts download on in its `AppConfig` (or, for the state-free ones, simply grants in its shell capability). Each
and cache, the store install rules and the update loop. In today's apps some of the Tauri command group is a list in `waybetter_host::commands`, each wrapper checks its caller first, and
wrappers around those modules are still written by the app (wayBetter for X has them). If you `waybetter_host::testkit` asserts both in your `tests/security.rs`.
build an app on the scaffold, expect to add the wrapper commands for the features you turn on.
Moving those wrappers into the host is planned. | Group | Turn on with | What it serves | What the app supplies |
| --- | --- | --- | --- |
| `STORE` | `AppConfig::with_store(&STORE)` | install links, dropped files, the signed Store, the install screen | its `StoreConfig` (app id, hosts, public keys) |
| `MEDIA` | `with_media()` | gallery folders, previews, the opt-in clipboard history and its watcher | attaching an image to the site's composer, if it has one (`media_commands::gallery_file` and `clip_image` give it the checked bytes) |
| `GFONTS` | `with_fonts()` | Google Fonts install, remove, preview (needs the `net` feature) | `SiteHooks::fonts_changed` (give the tabs their theme again) |
| `UPDATE` | `with_updates(&UpdaterConfig)` | update status, check now, apply, the update loop and the hotfix channel | the channel, its key and the download page |
| `SYNC` | `with_sync()` | encrypted folder sync | `SiteHooks::backup_sections` and `backup_section_names` |
| `DEV` | `with_dev()` | developer mode: live reload of plugins, custom CSS and a theme file | `SiteHooks::dev_theme_apply` and `dev_theme_end` |
| `WORKSPACES`, `BACKUP` | always served | saved layouts; settings backup (collect, export, open, apply) | for backup: `backup_drafts` and `backup_apply` (how each imported section is applied) |
What is still the app's to write today: keyword alerts' commands around `waybetter_host::alerts`,
the theme commands around `waybetter_host::theme` (wayBetter for X names them `x_*`), a
popover webview and anything else that is specific to the site. They are on the list to move.
## Repository layout ## Repository layout

View file

@ -440,8 +440,13 @@ statement checks its caller.
`read_json`/`write_json`, `remove_profile_dirs`, `prune_profile_dirs`, `migrate_identifier`, `read_json`/`write_json`, `remove_profile_dirs`, `prune_profile_dirs`, `migrate_identifier`,
`system_menu`. `system_menu`.
The app keeps its own `#[tauri::command]` wrappers for everything else, and its capability files; Besides the commands above, the host serves optional groups of shell-only commands that an app turns
its `build.rs` lists its commands through `commands::manifest`, which adds the host's. on with `AppConfig::with_*` (see "Optional command groups" in the README): `commands::STORE`,
`MEDIA`, `GFONTS`, `UPDATE`, `SYNC`, `DEV`, `WORKSPACES` and `BACKUP`, with the `SiteHooks` methods
that carry what only the app knows (`fonts_changed`, `backup_sections`, `backup_section_names`,
`backup_drafts`, `backup_apply`, `dev_theme_apply`, `dev_theme_end`). The app keeps its own
`#[tauri::command]` wrappers for everything site-specific, and its capability files; its `build.rs`
lists its commands through `commands::manifest`, which adds the host's.
The npm package adds the app-side tooling: The npm package adds the app-side tooling: