Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,19 @@ jobs:
- name: Test
run: pnpm run test:all

# The container image builds the server without Tauri.
- name: Check the server-only build
working-directory: src-tauri
run: cargo check --locked --no-default-features --bin tabularis

- name: Keep Tauri inside the desktop transport
run: |
if grep -rnE '(^|[^_[:alnum:]])tauri(::|_plugin)' src-tauri/src --include='*.rs' \
--exclude-dir=desktop | grep -v 'tauri::mobile_entry_point\|async_runtime\|tauri::test::'; then
echo "::error::Tauri code belongs in src-tauri/src/transport/desktop/ (see .rules/rust.md)"
exit 1
fi

web-e2e:
runs-on: ubuntu-24.04

Expand Down
1 change: 1 addition & 0 deletions .rules/rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
4. **Separate Rust tests from implementation:** When a module has non-trivial tests, place them in a sibling `tests.rs` file (or `tests/*.rs` when the module grows further) and load them with `#[cfg(test)] mod tests;`.
5. **Test extracted helpers directly:** Every extracted pure helper or parser should have unit tests covering nominal cases, edge cases, and unsupported inputs when relevant.
6. **Avoid behavioural refactors mixed with structural refactors:** When reorganizing Rust files, keep function signatures and runtime behaviour stable unless the task explicitly asks for behaviour changes.
7. **Keep Tauri in the desktop transport:** Tauri commands, plugins and anything that takes an `AppHandle`, `Window` or `State` live in `src-tauri/src/transport/desktop/`, which is the only module behind the `desktop` feature. Put the logic in `application/` (or a plain module) so the web RPC and the desktop command share it; the command stays a thin wrapper.
24 changes: 24 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# AGENTS.md

> [!IMPORTANT]
> **The backend layout changed (October 2026).** All Tauri code now lives in `src-tauri/src/transport/desktop/`, and desktop commands are thin wrappers over `src-tauri/src/application/`. Read [Backend layout](#backend-layout-desktop-and-web-transports) before you start, rebase, or review a PR that touches `src-tauri/`.

## Directives
Adhere to the rules defined in the [rules directory](./.rules/):
- [General Rules](./.rules/general.md) (Logging & Language)
Expand All @@ -14,6 +17,27 @@ Adhere to the rules defined in the [rules directory](./.rules/):

When reviewing pull requests, follow [REVIEW.md](./REVIEW.md).

## Backend layout: desktop and web transports

The Rust backend serves two transports over the same React frontend:

- **Tauri desktop app:** `src-tauri/src/transport/desktop/`
- **`tabularis web` server:** `src-tauri/src/transport/web/`

Shared logic lives in `src-tauri/src/application/` (and plain modules), so the app and the web behave the same.

- **Tauri code goes in `transport/desktop/` only.** That covers `#[tauri::command]`, `tauri_plugin_*`, and anything taking an `AppHandle`, `Window` or Tauri `State`. It is the only module behind the `desktop` cargo feature; `cargo build --no-default-features` builds the server without Tauri.
- **A desktop command is a thin wrapper over `application/`.** Implement the behaviour there, call it from the desktop command, and give the web RPC (`transport/web/rpc.rs`) a route to the same function.
- **The desktop command registry is in `transport/desktop/mod.rs`** (`run()` and `generate_handler!`), not in `lib.rs`.
- **CI enforces the boundary:** `cargo check --no-default-features` must pass, and a grep fails the build when `tauri::` or `tauri_plugin` appears outside `transport/desktop/`. See rule 7 in [Rust Rules](./.rules/rust.md).

**Branches and PRs started before this layout:**
- Rebase onto it.
- Move new or changed Tauri commands from `commands.rs`, `config.rs` and the like into the mirrored file under `transport/desktop/`.
- Drop `#[cfg(feature = "desktop")]` and `#[cfg_attr(feature = "desktop", tauri::command)]` from shared modules.
- Register commands in `transport/desktop/mod.rs`.
- Check for these commands, which had no frontend caller and were removed: `list_all_preferences`, `get_theme`, `save_blob_to_file`, `preview_tabularis_import`, `apply_tabularis_import`, `export_connections_payload`, `import_connections_payload`, `encrypt_export_payload`, `decrypt_export_payload`, `open_visual_explain_window`, `open_json_viewer_window`, `get_json_viewer_session`, `complete_json_viewer_session`, `open_results_window` and `close_results_window`.

<!-- gitnexus:start -->
# GitNexus — Code Intelligence

Expand Down
42 changes: 12 additions & 30 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
# Tabularis Web as a container image:
# docker build -f docker/Dockerfile -t tabularis .
#
# The binary still links WebKitGTK (Tauri is not optional), so the runtime
# carries those shared libraries even though `tabularis web` never opens a window.
# The server is built without the desktop app, so the image carries no GUI
# libraries. Debian rather than Alpine: registry driver plugins are glibc
# binaries and do not run on musl, not even through gcompat.

ARG NODE_VERSION=24.18.0
ARG DEBIAN_VERSION=trixie
Expand All @@ -24,55 +25,36 @@ RUN --mount=type=cache,id=pnpm-store,target=/root/.local/share/pnpm/store \
&& pnpm build

# ── Server ───────────────────────────────────────────────────────────────────
# Built without the `desktop` feature: no Tauri, GTK or WebKitGTK, only the
# `tabularis web` and `--mcp` entry points.
FROM rust:1-${DEBIAN_VERSION} AS server
ARG TABULARIS_BUILD_COMMIT=
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libwebkit2gtk-4.1-dev libgtk-3-dev libsoup-3.0-dev libdbus-1-dev \
pkg-config perl make \
&& apt-get install -y --no-install-recommends libdbus-1-dev pkg-config perl make \
&& rm -rf /var/lib/apt/lists/*

# Reported by the server contract (`option_env!`); empty for local builds.
ARG TABULARIS_BUILD_COMMIT=
WORKDIR /src
# The crate embeds the built frontend (`tauri::generate_context!`) and a few
# JSON schemas from outside src-tauri.
# JSON schemas and themes the crate embeds from outside src-tauri.
COPY plugins/manifest.schema.json ./plugins/manifest.schema.json
COPY packages/web-ui/src/schemas ./packages/web-ui/src/schemas
COPY packages/web-ui/src/themes ./packages/web-ui/src/themes
COPY --from=web-ui /src/packages/web-ui/dist ./packages/web-ui/dist
COPY src-tauri ./src-tauri
RUN --mount=type=cache,id=cargo-registry,target=/usr/local/cargo/registry \
--mount=type=cache,id=cargo-target,target=/src/src-tauri/target \
cd src-tauri \
&& cargo build --release --locked --bin tabularis \
&& cargo build --release --locked --no-default-features --bin tabularis \
&& install -Dm755 target/release/tabularis /out/tabularis

# ── Shared libraries ─────────────────────────────────────────────────────────
# Installing WebKitGTK drags in Mesa/LLVM, GStreamer, speech synthesis and more
# (~700 MB) that `tabularis web` never loads: GTK is never initialised. Only
# the libraries the binary links (its `ldd` closure) go into the runtime,
# under their canonical directory so merged-/usr symlinks such as /lib stay.
FROM debian:${DEBIAN_VERSION}-slim AS libs
RUN apt-get update \
&& apt-get install -y --no-install-recommends libwebkit2gtk-4.1-0 libdbus-1-3
COPY --from=server /out/tabularis /usr/bin/tabularis
RUN mkdir /libs \
&& ldd /usr/bin/tabularis | awk '/=> \// { print $3 }' | while read -r lib; do \
dir="$(readlink -f "$(dirname "$lib")")"; \
mkdir -p "/libs$dir" && cp -L "$lib" "/libs$dir/"; \
done

# ── Runtime ──────────────────────────────────────────────────────────────────
FROM debian:${DEBIAN_VERSION}-slim
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates curl tini openssh-client \
&& apt-get install -y --no-install-recommends \
ca-certificates curl tini openssh-client libdbus-1-3 \
&& rm -rf /var/lib/apt/lists/* \
&& useradd --system --uid 10001 --user-group --home-dir /data --no-create-home tabularis \
&& install -d -o 10001 -g 10001 -m 0750 /data
COPY --from=libs /libs/ /
COPY --from=server /out/tabularis /usr/bin/tabularis
# Fails the build if a linked library is missing.
RUN ldconfig && tabularis --help >/dev/null
RUN tabularis --help >/dev/null
COPY --from=web-ui /src/packages/web-ui/dist /usr/lib/tabularis/web-ui
COPY docker/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
ENV HOME=/data \
Expand Down
2 changes: 1 addition & 1 deletion packages/web-ui/src/api/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ export interface CommandMap {
>;
run_connections_backup: CommandDefinition<
undefined,
string | BackupRunResult,
BackupRunResult,
"sensitive"
>;

Expand Down
14 changes: 12 additions & 2 deletions packages/web-ui/src/components/modals/NewConnectionModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,13 @@ export const NewConnectionModal = ({
activeDriver?.capabilities?.no_connection_required === true;
// A raw URI is self-contained: it carries the database (or deliberately omits
// it, as Atlas URIs do) and the credentials, so it replaces those form fields.
const hasConnectionUri = !!formData.connection_uri?.trim();
// The browser never receives a stored URI. The backend keeps it on save as
// long as the driver is unchanged, so it still counts as present.
const hasStoredConnectionUri =
formData.connection_uri_in_keychain === true &&
initialConnection?.params.driver === driver;
const hasConnectionUri =
!!formData.connection_uri?.trim() || hasStoredConnectionUri;
// Drivers with the `connection_uri` capability consume the raw URI verbatim:
// host/port/username/database all derive from it, so the form only asks for
// the connection string and an optional token (password) field.
Expand Down Expand Up @@ -2902,7 +2908,11 @@ export const NewConnectionModal = ({
"flex-1 px-3 py-2 bg-base border rounded-md text-sm text-primary placeholder:text-muted placeholder:italic focus:border-focus focus:outline-none transition-colors",
connectionStringError ? "border-accent-error" : "border-strong",
)}
placeholder={connectionStringPlaceholder}
placeholder={
hasStoredConnectionUri && !formData.connection_uri
? t("newConnection.connectionUriStored")
: connectionStringPlaceholder
}
/>
{connectionString && !connectionStringError && (
<div className="px-3 py-2 bg-accent-success/10 border border-accent-success/30 rounded-md text-accent-success flex items-center">
Expand Down
14 changes: 5 additions & 9 deletions packages/web-ui/src/components/settings/BackupTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,12 @@ export function BackupTab() {
try {
const result = await client.call("run_connections_backup", undefined);
await refreshStatus();
if (typeof result === "string") {
showAlert(t("settings.backup.backupDone", { path: result }));
} else {
if (result.download) {
await saveGeneratedFile(client, platform, result.download);
}
showAlert(
t("settings.backup.backupDone", { path: result.serverLocation }),
);
if (result.download) {
await saveGeneratedFile(client, platform, result.download);
}
showAlert(
t("settings.backup.backupDone", { path: result.serverLocation }),
);
} catch (e) {
showAlert(toErrorMessage(e));
} finally {
Expand Down
1 change: 1 addition & 0 deletions packages/web-ui/src/i18n/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1153,6 +1153,7 @@
"dbNameRequired": "Datenbankname ist erforderlich",
"connectionUriRequiresKeychain": "Verbindungs-URIs müssen im Keychain des Betriebssystems gespeichert werden. Aktiviere „Passwörter im Keychain speichern“, um fortzufahren.",
"connectionUriRequired": "Verbindungs-URI ist erforderlich",
"connectionUriStored": "Im Schlüsselbund des Systems gespeichert. Füge einen neuen Verbindungs-String ein, um ihn zu ersetzen.",
"connectionString": "Verbindungszeichenfolge",
"connectionStringPlaceholder": "z. B. mysql://user:pass@localhost:3306/db",
"connectionStringExample": "Beispiel f?r eine Verbindungszeichenfolge",
Expand Down
1 change: 1 addition & 0 deletions packages/web-ui/src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1220,6 +1220,7 @@
"dbNameRequired": "Database name is required",
"connectionUriRequiresKeychain": "Connection URIs must be saved in the OS keychain. Enable “Save passwords in Keychain” to continue.",
"connectionUriRequired": "Connection URI is required",
"connectionUriStored": "Stored in the OS keychain. Paste a new connection string to replace it.",
"connectionString": "Connection String",
"connectionStringPlaceholder": "e.g. mysql://user:pass@localhost:3306/db",
"connectionStringExample": "Connection string example",
Expand Down
1 change: 1 addition & 0 deletions packages/web-ui/src/i18n/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -1181,6 +1181,7 @@
"dbNameRequired": "El nombre de la base de datos es requerido",
"connectionUriRequiresKeychain": "Las URI de conexión deben guardarse en el Llavero del sistema. Activa “Guardar contraseñas en el Llavero” para continuar.",
"connectionUriRequired": "El URI de conexión es requerido",
"connectionUriStored": "Guardada en el llavero del sistema. Pega una nueva cadena de conexión para reemplazarla.",
"connectionString": "Cadena de conexi?n",
"connectionStringPlaceholder": "p. ej. mysql://user:pass@localhost:3306/db",
"connectionStringExample": "Ejemplo de cadena de conexi?n",
Expand Down
1 change: 1 addition & 0 deletions packages/web-ui/src/i18n/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1190,6 +1190,7 @@
"dbNameRequired": "Le nom de la base de données est requis",
"connectionUriRequiresKeychain": "Les URI de connexion doivent être enregistrées dans le trousseau du système. Activez « Enregistrer les mots de passe dans le trousseau » pour continuer.",
"connectionUriRequired": "L'URI de connexion est requise",
"connectionUriStored": "Enregistrée dans le trousseau du système. Collez une nouvelle chaîne de connexion pour la remplacer.",
"connectionString": "Cha?ne de connexion",
"connectionStringPlaceholder": "p. ex. mysql://user:pass@localhost:3306/db",
"connectionStringExample": "Exemple de cha?ne de connexion",
Expand Down
1 change: 1 addition & 0 deletions packages/web-ui/src/i18n/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -1216,6 +1216,7 @@
"dbNameRequired": "Il nome del database è richiesto",
"connectionUriRequiresKeychain": "Gli URI di connessione devono essere salvati nel Portachiavi di sistema. Attiva “Salva password nel Portachiavi” per continuare.",
"connectionUriRequired": "L'URI di connessione è richiesto",
"connectionUriStored": "Salvata nel portachiavi di sistema. Incolla una nuova stringa di connessione per sostituirla.",
"connectionString": "Stringa di connessione",
"connectionStringPlaceholder": "es. mysql://user:pass@localhost:3306/db",
"connectionStringExample": "Esempio di stringa di connessione",
Expand Down
1 change: 1 addition & 0 deletions packages/web-ui/src/i18n/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -1167,6 +1167,7 @@
"dbNameRequired": "データベース名は必須です",
"connectionUriRequiresKeychain": "接続 URI は OS のキーチェーンに保存する必要があります。「パスワードをキーチェーンに保存」を有効にしてください。",
"connectionUriRequired": "接続 URI は必須です",
"connectionUriStored": "OS のキーチェーンに保存されています。置き換えるには新しい接続文字列を貼り付けてください。",
"connectionString": "?????",
"connectionStringPlaceholder": "?: mysql://user:pass@localhost:3306/db",
"connectionStringExample": "???????",
Expand Down
1 change: 1 addition & 0 deletions packages/web-ui/src/i18n/locales/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,7 @@
"dbNameRequired": "데이터베이스 이름은 필수입니다",
"connectionUriRequiresKeychain": "연결 URI는 OS 키체인에 저장해야 합니다. “키체인에 비밀번호 저장”을 활성화하세요.",
"connectionUriRequired": "연결 URI는 필수입니다",
"connectionUriStored": "OS 키체인에 저장되어 있습니다. 바꾸려면 새 연결 문자열을 붙여 넣으세요.",
"connectionString": "?? ???",
"connectionStringPlaceholder": "?: mysql://user:pass@localhost:3306/db",
"connectionStringExample": "?? ??? ??",
Expand Down
1 change: 1 addition & 0 deletions packages/web-ui/src/i18n/locales/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,7 @@
"nameRequired": "O nome da conexão é obrigatório",
"dbNameRequired": "O nome do banco de dados é obrigatório",
"connectionUriRequired": "O URI da conexão é obrigatório",
"connectionUriStored": "Armazenada no chaveiro do sistema. Cole uma nova string de conexão para substituí-la.",
"connectionString": "String de conex?o",
"connectionStringPlaceholder": "ex.: mysql://user:pass@localhost:3306/db",
"connectionStringExample": "Exemplo de string de conex?o",
Expand Down
1 change: 1 addition & 0 deletions packages/web-ui/src/i18n/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -1152,6 +1152,7 @@
"dbNameRequired": "Название базы данных обязательно",
"connectionUriRequiresKeychain": "URI подключения должны храниться в системном хранилище ключей. Включите «Сохранять пароли в Keychain», чтобы продолжить.",
"connectionUriRequired": "Требуется URI подключения",
"connectionUriStored": "Сохранено в системной связке ключей. Вставьте новую строку подключения, чтобы заменить её.",
"connectionString": "?????? ???????????",
"connectionStringPlaceholder": "????????, mysql://user:pass@localhost:3306/db",
"connectionStringExample": "?????? ?????? ???????????",
Expand Down
1 change: 1 addition & 0 deletions packages/web-ui/src/i18n/locales/tl.json
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,7 @@
"dbNameRequired": "Kailangan ang pangalan ng database",
"connectionUriRequiresKeychain": "Dapat i-save ang mga connection URI sa OS keychain. I-enable ang “I-save ang mga password sa Keychain” para magpatuloy.",
"connectionUriRequired": "Kailangan ang connection URI",
"connectionUriStored": "Naka-save sa keychain ng OS. Mag-paste ng bagong connection string para palitan ito.",
"connectionString": "Connection string",
"connectionStringPlaceholder": "hal. mysql://user:pass@localhost:3306/db",
"connectionStringExample": "Halimbawa ng connection string",
Expand Down
1 change: 1 addition & 0 deletions packages/web-ui/src/i18n/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -1129,6 +1129,7 @@
"dbNameRequired": "数据库名称是必需的",
"connectionUriRequiresKeychain": "连接 URI 必须保存在操作系统密钥链中。请启用“在密钥链中保存密码”后继续。",
"connectionUriRequired": "连接 URI 是必需的",
"connectionUriStored": "已保存在系统钥匙串中。粘贴新的连接字符串即可替换。",
"connectionString": "?????",
"connectionStringPlaceholder": "?? mysql://user:pass@localhost:3306/db",
"connectionStringExample": "???????",
Expand Down
Loading
Loading