This document describes the design of the OpenVCS application in this module and is intended for contributors making behavior changes.
For a concise architecture map, see ARCHITECTURE.md.
For plugin packaging/runtime details, see docs/plugin architecture.md and docs/plugins.md.
This module contains the running application:
Frontend/: TypeScript + Vite UI and interaction logic.Backend/: Rust + Tauri host runtime.
This design doc focuses on behavioral boundaries, runtime flows, and contributor guardrails.
- Keep the UI responsive while running potentially long VCS operations.
- Keep VCS, filesystem, and process operations in backend command handlers.
- Support multiple VCS implementations through plugin-provided backends.
- Keep third-party/plugin execution isolated from the host process.
OpenVCS client is split into three main runtime concerns:
- UI layer (
Frontend/src/scripts/): renders state and invokes backend commands. - Host layer (
Backend/src/): owns app state, command handling, and orchestration. - Plugin modules (
.ovcspbundles): out-of-process Node.js modules used by backend/plugin runtime.
Primary request flow:
- UI calls
TAURI.invoke(...)viaFrontend/src/scripts/lib/tauri.ts. - Tauri routes to handlers registered in
Backend/src/lib.rs. - Handler resolves state/current repo and runs backend operation.
- Backend emits events/logs to UI as needed.
UI code under Frontend/src/scripts/features/ delegates repository operations to backend commands.
Backend/src/state.rs and command modules under Backend/src/tauri_commands/ are the source of truth for active repo, recents, settings, and output log.
Plugin backend/function modules communicate over JSON-RPC over stdio (Backend/src/plugin_runtime/node_instance.rs and Backend/src/plugin_runtime/vcs_proxy.rs), not in-process calls.
Current repo/backend validity checks and progress forwarding are centralized in shared command helpers (Backend/src/tauri_commands/shared.rs).
- Backend starts in
Backend/src/lib.rs::run. - Built-in plugin bundles are synchronized (
plugin_bundles). - Optional reopen-last-repo behavior executes.
- Optional update check can emit
ui:update-available.
- User actions like clone/open/add repo invoke commands in
Backend/src/tauri_commands/general.rs. - Backend resolves and opens the repository through plugin VCS backend resolution (
Backend/src/plugin_vcs_backends.rs). - On successful selection, backend emits
repo:selected.
- Feature commands (status, branch, commit, remotes, stash, conflicts, repo files) run through dedicated modules in
Backend/src/tauri_commands/. - Long-running operations use blocking-task wrappers (
run_repo_task) and emit progress/log events.
- Plugin discovery, load, installation, uninstall, approval gating, and function invocation are handled in
Backend/src/tauri_commands/plugins.rsplus plugin store/runtime modules.
OpenVCS keeps a clear split between:
- Global settings (
get_global_settings/set_global_settings). - Repo-scoped settings (
get_repo_settings/set_repo_settings). - Active repository handle in backend state (validated before use).
- Recent repositories list and output-log buffers.
If a selected backend disappears (for example plugin disabled/uninstalled), backend rejects stale operations and clears active repo selection.
Backend emits events for reactive UI updates and progress feedback, including:
repo:selectedgit-progressvcs:log- SSH/auth prompt events from remote operations
- updater-related events (
ui:update-available,update:progress, completion/failure events)
Event producers are primarily in:
Backend/src/tauri_commands/shared.rsBackend/src/tauri_commands/remotes.rsBackend/src/tauri_commands/updater.rsBackend/src/tauri_commands/plugins.rsBackend/src/tauri_commands/general.rs
Frontend listeners are attached through TAURI.listen(...) in feature modules.
- Command handlers return stringified errors at the Tauri boundary for predictable UI handling.
- Plugin module execution has timeout/restart/backoff behavior in runtime helpers.
- Bundle install/runtime path and approval checks are enforced in backend plugin subsystems.
- Output logging is centralized so operations can be inspected in the output-log UI.
When adding or changing behavior:
- Add backend command handlers under the relevant file in
Backend/src/tauri_commands/. - Register commands in
Backend/src/lib.rsinvoke handler. - Call them from
Frontend/src/scripts/features/...viaTAURI.invoke. - Emit/consume events only when asynchronous feedback is needed.
- Keep repo/VCS logic in backend; keep frontend focused on presentation and interaction.
- Update docs when architectural boundaries, plugin behavior, or user-visible flows change.
ARCHITECTURE.mdBackend/src/lib.rsBackend/src/tauri_commands/mod.rsBackend/src/tauri_commands/shared.rsBackend/src/plugin_runtime/node_instance.rsBackend/src/plugin_runtime/vcs_proxy.rsBackend/src/plugin_vcs_backends.rsFrontend/src/scripts/lib/tauri.tsFrontend/src/scripts/main.tsdocs/plugin architecture.mddocs/plugins.md