server: use single XDG server database

This commit is contained in:
2026-07-24 08:45:51 +09:00
parent 19d5396897
commit 4ff599c011
16 changed files with 293 additions and 485 deletions
+5 -24
View File
@@ -27,13 +27,12 @@ The Vite dev server proxies `/api/*` to `http://127.0.0.1:8787`, so frontend hot
If you want to run the backend from the repository root instead:
```bash
cargo run -p yoi-workspace-server -- serve \
--workspace . \
--db .yoi/workspace.db \
--listen 127.0.0.1:8787
cargo run -p yoi-workspace-server -- serve --listen 127.0.0.1:8787
```
## Static build served by Rust backend
The backend reads Workspace records from the Yoi server DB at `<data_dir>/server/server.db`. Run `cargo run -p yoi-workspace-server -- init --workspace .` first when the server DB has not been initialized.
## Static build
Build the SPA:
@@ -41,25 +40,7 @@ Build the SPA:
deno task build
```
Then serve the static build and API from the Rust backend:
```bash
cargo run -p yoi-workspace-server -- serve \
--workspace ../.. \
--db ../../.yoi/workspace.db \
--frontend build \
--listen 127.0.0.1:8787
```
From the repository root, the equivalent command is:
```bash
cargo run -p yoi-workspace-server -- serve \
--workspace . \
--db .yoi/workspace.db \
--frontend web/workspace/build \
--listen 127.0.0.1:8787
```
Static asset packaging is a deployment concern. Local development normally uses the Vite dev server proxy plus the Rust backend command above.
## Checks
+1 -1
View File
@@ -4,7 +4,7 @@
"tasks": {
"install": "deno install",
"dev": "deno run -A npm:vite@7.2.7 dev",
"dev:backend": "cd ../.. && cargo run -p yoi-workspace-server -- serve --workspace . --db .yoi/workspace.db --listen 127.0.0.1:8787",
"dev:backend": "cd ../.. && cargo run -p yoi-workspace-server -- serve --listen 127.0.0.1:8787",
"check": "deno run -A npm:@sveltejs/kit@2.49.4 sync && deno run -A npm:svelte-check@4.3.4 --tsconfig ./tsconfig.json",
"test": "deno test --allow-read=src --allow-env=VSCODE_TEXTMATE_DEBUG src/lib/workspace/auth/model.test.ts src/lib/workspace/api/http.test.ts src/lib/workspace/console/chat-submit.test.ts src/lib/workspace/console/composer-command.test.ts src/lib/workspace/console/composer-completion.test.ts src/lib/workspace/console/markdown.test.ts src/lib/workspace/console/model.test.ts src/lib/workspace/console/worker-console.ui.test.ts src/lib/workspace/settings/model.test.ts src/lib/workspace/sidebar/workers.test.ts src/lib/workspace/sidebar/worker-launch.test.ts src/lib/workspace/sidebar/repository-nav.test.ts",
"build": "deno run -A npm:vite@7.2.7 build",