fix(server): aligner app-data-dir sur l'identifier desktop + corriger doc build web (#13)

default_app_data_dir aligné sur l'identifier tauri app.idea.ide, avec
précédence IDEA_APP_DATA_DIR > XDG_DATA_HOME > HOME. Log stderr
`idea --serve: app data dir = <path>` au démarrage et test de précédence.
Doc build web corrigée (VITE_TRANSPORT=http npx vite build + npm au lieu
de pnpm), section app-data-dir et avertissement double-writer desktop/serve.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-16 08:39:22 +02:00
parent 6117177957
commit c9ce3d7c4e
2 changed files with 82 additions and 4 deletions

View File

@ -5,14 +5,35 @@ build must be available as a web root containing `index.html`.
## Local Development
The web build **must** be produced with the `http` transport, otherwise the
served `dist/` is a desktop (Tauri) build that fails in a plain browser with
`window.__TAURI_INTERNALS__ is undefined`. The frontend uses **npm**, not pnpm:
```bash
pnpm --dir frontend build
idea --serve --web-root frontend/dist
cd frontend && VITE_TRANSPORT=http npx vite build && cd ..
idea --serve --web-root frontend/dist --app-data-dir "$HOME/.local/share/app.idea.ide"
```
The default local listener is `127.0.0.1:17373`. Loopback development may use
plain HTTP; the session cookie is still `HttpOnly` and `SameSite=Strict`.
### App data directory (must match the desktop app)
`idea --serve` reads/writes the same on-disk data as the desktop app
(projects, profiles, templates). It resolves the app-data directory in this
order:
1. `--app-data-dir PATH`
2. `IDEA_APP_DATA_DIR`
3. platform default for the Tauri identifier `app.idea.ide`
(`$XDG_DATA_HOME/app.idea.ide`, else `$HOME/.local/share/app.idea.ide`)
The resolved path is printed at startup (`idea --serve: app data dir = …`).
> **Do not run the desktop app and `idea --serve` on the same app-data
> directory at the same time.** There is no inter-process lock yet, so two
> concurrent writers can corrupt state. Close the desktop app while serving.
## Packaged Artifact
The release artifact is still a single IdeA binary/AppImage. Packaging must copy