44154a4697
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
14 KiB
14 KiB
phase, plan, type, wave, depends_on, files_modified, autonomous, requirements, user_setup, must_haves
| phase | plan | type | wave | depends_on | files_modified | autonomous | requirements | user_setup | must_haves | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 06-desktop-client-ci-cd | 01 | execute | 1 |
|
false |
|
|
Purpose: A user can run the desktop app and reach the live Tessera web app — the thinnest end-to-end desktop experience. All native polish (tray, window state, autostart, notifications, icon, production bundles) is layered on in Plan 06-02.
Output: A runnable apps/desktop Tauri project (pnpm --filter=@tessera/desktop tauri dev)
that connects to a user-configured server URL and remembers it.
<execution_context> @$HOME/.claude/gsd-core/workflows/execute-plan.md @$HOME/.claude/gsd-core/templates/summary.md </execution_context>
@.planning/PROJECT.md @.planning/ROADMAP.md @.planning/STATE.md @.planning/phases/06-desktop-client-ci-cd/06-CONTEXT.md @.planning/phases/06-desktop-client-ci-cd/06-RESEARCH.md @pnpm-workspace.yaml @apps/web/src/app/globals.css<artifacts_this_phase_produces> This plan introduces the following symbols/files (consumed by Plan 06-02):
apps/desktop/— Tauri project root, pnpm package@tessera/desktopapps/desktop/src-tauri/src/lib.rs::run()— Rust entry function (extended in 06-02)apps/desktop/src-tauri/tauri.conf.json— central Tauri config (window, bundle, plugins)apps/desktop/src-tauri/capabilities/default.json— permission grants (extended in 06-02)apps/desktop/src/setup.html— first-run server URL page- tauri-plugin-store
config.jsonkeyserver_url— persisted server URL contract </artifacts_this_phase_produces>
Execute these commands (the executor presents them; the human runs/authorizes sudo):
- apt install: `sudo apt install libwebkit2gtk-4.1-dev build-essential curl wget file libxdo-dev libssl-dev libayatana-appindicator3-dev librsvg2-dev`
- Rust: `curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh -s -- -y` then `source "$HOME/.cargo/env"`
Run each and confirm a real version/path is printed (not "not found"):
1. `rustc --version` prints a version >= 1.77.2
2. `cargo --version` prints a version
3. `pkg-config --modversion webkit2gtk-4.1` prints a version (e.g. 2.x)
4. `pkg-config --exists libssl && echo OK` prints OK
- `rustc --version` exits 0 and prints version >= 1.77.2
- `pkg-config --modversion webkit2gtk-4.1` exits 0 (no "not found")
Type "approved" once all four checks print versions, or describe which failed
Task 2: Scaffold apps/desktop Tauri project as URL-loading wrapper
apps/desktop/package.json, apps/desktop/src-tauri/Cargo.toml, apps/desktop/src-tauri/tauri.conf.json, apps/desktop/src-tauri/build.rs, apps/desktop/src-tauri/src/main.rs, apps/desktop/src-tauri/src/lib.rs, apps/desktop/src-tauri/capabilities/default.json
- .planning/phases/06-desktop-client-ci-cd/06-RESEARCH.md (Pattern 1 URL-Loading WebView, Recommended Project Structure, Cargo.toml Plugin Dependencies, Capabilities Configuration, Pitfall 6 monorepo scaffolding)
- pnpm-workspace.yaml (confirms apps/* glob already covers apps/desktop)
- apps/api/package.json (for name/version pattern: `@tessera/*`, version 0.0.1, private true)
Create `apps/desktop/` manually to avoid the monorepo scaffold confusion in Pitfall 6 (do NOT run
create-tauri-app at repo root). Set package.json name to `@tessera/desktop`, version `0.0.1`, private true,
with scripts `tauri` (runs `tauri`), `dev` (`tauri dev`), `build` (`tauri build`). Add devDependency
`@tauri-apps/cli@2.11.3` and dependencies `@tauri-apps/api@2.11.1` plus `@tauri-apps/plugin-store@2.4.3`.
Install via `pnpm add -D @tauri-apps/cli --filter=@tessera/desktop` and `pnpm add @tauri-apps/api @tauri-apps/plugin-store --filter=@tessera/desktop`.
Create `src-tauri/Cargo.toml` with package name `tessera-desktop`, edition 2021, a `[lib]` entry named
`tessera_desktop_lib` (crate-type cdylib + staticlib + rlib), build-dependency `tauri-build = "2"`, and
dependencies: `tauri = { version = "2", features = ["tray-icon"] }`, `tauri-plugin-store = "2"`,
`serde = { version = "1", features = ["derive"] }`, `serde_json = "1"`. Only the store plugin is wired in
this plan; notification/autostart/window-state are added in 06-02.
Create `src-tauri/build.rs` calling `tauri_build::build()`.
Create `src-tauri/tauri.conf.json`: `productName` "Tessera", `version` "0.0.1", `identifier`
"de.ctl.tessera.desktop". Under `build`, set `frontendDist` to `../src` (the local setup page directory) and
`devUrl` to `http://localhost:1420`. Under `app.windows`, one window: label "main", title "Tessera",
width 1280, height 800, center true, decorations true, resizable true. Set `app.withGlobalTauri` true.
Add `app.security.csp` allowing connection to the configured server (use `default-src 'self'; connect-src *`
for the URL-configurable wrapper per D-02). Under `bundle`, set `active` true, `targets` `["appimage", "nsis"]`,
`icon` `["icons/icon.png", "icons/icon.ico"]` (icons added in 06-02 — note this in a SUMMARY follow-up if build
is attempted before icons exist).
Create `src-tauri/src/main.rs` as the generated entry: `#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]`
then `fn main() { tessera_desktop_lib::run() }`.
Create `src-tauri/src/lib.rs` exposing `pub fn run()`. Register the store plugin via
`tauri_plugin_store::Builder::new().build()`. In a `.setup(|app| { ... })` callback, open the store
`config.json`, read key `server_url`; if present, get the `main` webview window and call `window.navigate(url)`
to load the configured server; if absent, leave the WebView on the bundled setup page. Use
`tauri::generate_context!()` in `.run(...)`.
Create `src-tauri/capabilities/default.json` with identifier "default", windows `["main"]`, permissions
`["core:default", "store:default"]` (additional permissions added in 06-02).
test -f apps/desktop/src-tauri/tauri.conf.json && test -f apps/desktop/src-tauri/src/lib.rs && grep -q '@tessera/desktop' apps/desktop/package.json && grep -q 'store:default' apps/desktop/src-tauri/capabilities/default.json && cd apps/desktop/src-tauri && cargo check 2>&1 | grep -qiv 'could not find webkit'
- `apps/desktop/package.json` name is `@tessera/desktop`
- `cargo check` inside `apps/desktop/src-tauri` completes without WebKitGTK "could not find" errors
- `tauri.conf.json` `frontendDist` is `../src` (not a hardcoded server URL)
- `lib.rs` reads `server_url` from store and calls `navigate` when present
cargo check passes; pnpm recognizes @tessera/desktop; config loads the local setup page as frontendDist
Task 3: First-run setup page — server URL input, validation, persistence, navigate
apps/desktop/src/setup.html
- .planning/phases/06-desktop-client-ci-cd/06-RESEARCH.md (Pattern 3 Configurable Server URL, First-Run Setup Page code example, Security Domain — V5 Input Validation, malicious URL threat)
- apps/web/src/app/globals.css (OKLCH design tokens: --primary oklch(0.91 0.19 102), dark background oklch(0.17 0.01 260) — match setup page colors to the design system per D-06 spirit)
Create `apps/desktop/src/setup.html` as the local first-run page (D-02). It must:
- Render a centered card on dark background `oklch(0.17 0.01 260)` with a "Tessera" heading and a URL input
pre-filled with `http://localhost:3000`, plus a "Verbinden" button styled with primary `oklch(0.91 0.19 102)`.
All visible strings in German (response_language de): heading "Tessera", label "Server-URL eingeben:",
button "Verbinden", error text "Ungueltige URL" for invalid input.
- On submit, validate input with the `URL` constructor (per the established Phase 5 pattern, decision [05]
"URL constructor for client-side https-only validation"). Reject empty/malformed input; for non-https URLs
that are not localhost, show a warning string but allow (internal LAN servers may be http) — this mitigates
the malicious-URL Tampering threat T-06-01 (V5 input validation).
- On valid input, `import { load } from '@tauri-apps/plugin-store'`, `load('config.json', { autoSave: true })`,
`store.set('server_url', url)`, then `window.location.href = url` to navigate the WebView to the server.
- Use `<script type="module">` and rely on `withGlobalTauri`/the store plugin already permitted in capabilities.
test -f apps/desktop/src/setup.html && grep -q "server_url" apps/desktop/src/setup.html && grep -q "new URL" apps/desktop/src/setup.html && grep -q "plugin-store" apps/desktop/src/setup.html
- setup.html validates the URL with `new URL(...)` before saving
- setup.html calls `store.set('server_url', ...)` and then navigates to the URL
- Visible strings are German ("Verbinden", "Server-URL eingeben:")
Entering a valid URL persists it to config.json and navigates the WebView; invalid input is rejected with a German error
<threat_model>
Trust Boundaries
| Boundary | Description |
|---|---|
| user input → WebView navigation | Server URL typed by user controls where the WebView connects (untrusted text crosses into navigation) |
| local config store → app startup | Persisted server_url is read on launch and drives navigation |
STRIDE Threat Register
| Threat ID | Category | Component | Disposition | Mitigation Plan |
|---|---|---|---|---|
| T-06-01 | Tampering | setup.html server URL input | mitigate | Validate with new URL() constructor; reject malformed; warn on non-https non-localhost (V5 input validation) |
| T-06-02 | Spoofing | WebView navigation target | accept | Internal-only tool; URL is user-chosen by design (D-02). CSP connect-src * required for configurable server. Locking to a single domain conflicts with the configurable-URL requirement; revisit at external-sales stage |
| T-06-03 | Information Disclosure | config.json stored URL | accept | URL is non-secret connection info stored via plugin-store (atomic, app-scoped path), not plaintext app config |
| T-06-SC | Tampering | npm/cargo installs | mitigate | All Tauri packages [Approved] in RESEARCH.md Package Legitimacy Audit; no [ASSUMED]/[SUS] blocking packages in this plan |
| </threat_model> |
<success_criteria>
- Tauri toolchain installed and verifiable (rustc, webkit2gtk-4.1 pkg-config)
apps/desktopexists as@tessera/desktopandcargo checkpasses- First-run setup page persists the server URL and connects the WebView to it (DESK-02)
- No frontend assets bundled —
frontendDistis the local setup page only (DESK-01 wrapper pattern) </success_criteria>