chore: .deb packaging, phase 3/5 docs, lessons, env example

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
dasemuandClaude Sonnet 5.5 committed 2026-11-16 13:39:01 +01:00
1 parent 8e118c90ba
commit fcc0ea1f12
8 files changed
+129 -6

No files matched your search

+5 -1
View File
@@ -1 +1,5 @@
# No environment variables are read yet. Add names only (never values) as they appear.
# grove reads no .env file. Provider tokens normally live in the system keyring (`grove login`).
# Headless override (CI, servers without a Secret Service): GROVE_TOKEN_<ID>, where <ID> is the provider
# id upper-cased with non-alphanumerics replaced by `_`. Example for a provider called "home":
# GROVE_TOKEN_HOME=
# GROVE_BIN= # GUI shell only: path of the grove CLI (default: `grove` from PATH)
+9 -5
View File
@@ -3,23 +3,27 @@
## Overview
Linux tool that keeps chosen git repos continuously in sync across machines, including
uncommitted work, via snapshot refs (`refs/sync/<machine>/<branch>`) on a primary remote.
Planned as a Rust workspace (core, providers, daemon, CLI, Tauri GUI). Currently in
**Phase 0 done, Phase 1 implemented and validated against the real Gitea with two simulated machines (real two-PC run still pending)**: `grove-core` + `grove` CLI (`status`, `snapshot`, `add`, `sync`, `doctor`); daemon (`groved`, Phase 2) implemented (not yet run on the real two PCs); GUI and providers do not exist yet. Do not start a
new phase before its predecessor's results are written to `docs/`.
Rust workspace: `grove-core`, `grove` (CLI), `grove-daemon` (`groved`), `grove-providers` (Gitea/Forgejo/GitHub),
`grove-bridge` (localhost HTTP bridge for the GUI), plus `gui/ui` (plain HTML/JS) and `gui/src-tauri` (Tauri shell,
outside the workspace, never compiled yet). Phases 0-5 are implemented; the real two-PC run is still pending.
Do not start new work before the previous results are written to `docs/`.
## Commands
- Check shell scripts: `for f in spikes/*.sh; do bash -n "$f"; done`
- Throwaway Forgejo (dev only, Podman): `spikes/forgejo-up.sh`, then `spikes/phase0.sh`
- Rust: `cargo fmt --check`, `cargo clippy --all-targets -- -D warnings`, `cargo test`
- Daemon: `cargo run -p grove-daemon --bin groved -- --config PATH`; client `grove daemon status`
- GUI in a browser: `cargo run -p grove-bridge -- --ui gui/ui`; Tauri shell: see `docs/phase3.md`
- Package: `cargo build --release --workspace && cargo deb -p grove --no-build`
- Throwaway e2e on a local Forgejo: `spikes/phase4-e2e.sh`
## Architecture
See `docs/` (`phase0-spike.md`, `phase1.md`, `phase2.md`, `DECISIONS.md`). Git is the storage layer; shell out to
See `docs/` (`phase0-spike.md` ... `phase5.md`, `DECISIONS.md`). Git is the storage layer; shell out to
system `git`; snapshots use a temp `GIT_INDEX_FILE` + `commit-tree`, never touching the
user's branch or index.
## Conventions
- Dependencies: serde+toml (config), clap+anyhow (CLI), notify+serde_json (daemon), approved. Ask before adding more.
- Dependencies: serde+toml, clap+anyhow, notify+serde_json, ureq, keyring, age, tauri v2 (GUI shell), approved. Ask before adding more.
- Everything in the repo is English. Open questions go to `docs/DECISIONS.md`.
- Never destroy local work; divergence is surfaced, never auto-merged.
+3
View File
@@ -5,3 +5,6 @@
- `Git::run` trims stdout, which also eats the leading space of the first `status --porcelain` line (` M x` becomes `M x`). Don't assert on that format via `run`.
- Fetch other machines' snapshots into `refs/sync-remote/*`, never into `refs/sync/*`, or a fetch can clobber this machine's own refs.
- Run tests that create many temp repos with unique dir names (pid + nanos); the shared `tests/common` helper does this.
- Bare-layout clones must set upstream tracking per branch, or `status` silently reports Synced for Behind/Diverged. Assert tracking in tests of any clone path.
- Unix socket paths are limited to ~100 bytes: use a short `XDG_RUNTIME_DIR` (e.g. `/tmp/gd`) when running a daemon from deep scratch dirs.
- Mock-server tests must parse the JSON request body; pretty-printed JSON breaks string asserts.
+13
View File
@@ -0,0 +1,13 @@
[Unit]
Description=grove daemon (keeps git repos in sync across machines)
Documentation=https://git.zenvairo.es/dasemu/Grove
[Service]
Type=simple
ExecStart=/usr/bin/groved
Restart=on-failure
RestartSec=5
# Nothing to flush on stop: all durable state lives in git, so a plain SIGTERM is safe.
[Install]
WantedBy=default.target
+12
View File
@@ -13,3 +13,15 @@ grove-daemon = { version = "0.1.0", path = "../grove-daemon" }
grove-providers = { version = "0.1.0", path = "../grove-providers" }
serde_json = "1.0.154"
toml = "1.2.1"
# `cargo build --release --workspace && cargo deb -p grove --no-build` packages CLI + daemon + user unit.
[package.metadata.deb]
name = "grove"
section = "devel"
depends = "$auto, git"
extended-description = "Keeps chosen git repos continuously in sync across machines, including uncommitted work."
assets = [
["../../target/release/grove", "usr/bin/", "755"],
["../../target/release/groved", "usr/bin/", "755"],
["../../contrib/groved.deb.service", "usr/lib/systemd/user/groved.service", "644"],
]
+6
View File
@@ -82,3 +82,9 @@ exclusion of `refs/sync/*` on this Gitea (needs a mirror target and credentials)
Observed UX noise: a stale snapshot from another machine is reported as "not applied" on every
pass until that machine syncs again.
## Bug found later (Phase 5 tests)
`clone_bare_layout` created worktrees without upstream tracking, so `Diverged` and `Behind` were
reported as `Synced` on repos cloned by grove itself. Fixed: every local branch with an `origin/<br>`
counterpart gets `--set-upstream-to` before worktrees are materialized (asserted in `tests/registry.rs`).
+55
View File
@@ -0,0 +1,55 @@
# Phase 3: GUI
## Layout
| Part | Where | Status |
|---|---|---|
| Frontend (plain HTML/CSS/JS, no build step) | `gui/ui/` | Implemented, exercised in a browser against a live daemon |
| Dev bridge (`grove-bridge`, std-only HTTP server on 127.0.0.1) | `crates/grove-bridge/` | Implemented, unit-tested, exercised end to end |
| Tauri v2 shell with tray | `gui/src-tauri/` | **Written but never compiled** (see below) |
The frontend talks to a backend through one adapter in `gui/ui/app.js`: `window.__TAURI__` commands
(`ipc`, `cli`, `config`) when running inside Tauri, otherwise `fetch('/api/...')` against the bridge.
The GUI contains no sync logic: state comes from the daemon over its Unix socket, and every action
(new, import, resolve, login, secrets, bootstrap) shells out to the allow-listed `grove` subcommands.
## Screens
Repositories (aggregate pill: all synced / syncing / paused / needs attention / daemon offline),
repository detail (per-worktree state and what the next pass will do, resolve panel for `Diverged`),
Activity (live log, filter), New repository, Import, Settings (config, token login, config repo,
secrets), and onboarding when no config exists. Toasts (and browser notifications when permitted)
fire on a transition into `Diverged` or `Error`.
Resolve actions (save as branch / take remote / keep mine) always ask for confirmation and write a
backup ref first. Comparing both sides stays in the CLI (`grove resolve --compare`).
## Dev bridge safety
Binds 127.0.0.1 only, rejects non-local `Host` headers (DNS rebinding) and POSTs without
`X-Grove: 1` (cross-site forms cannot set it). Only these subcommands are forwarded: `init login new
import config-repo-init bootstrap resolve secrets sync status`. Verified: a POST without the header gets 403.
```bash
cargo run -p grove-bridge -- --ui gui/ui # then open http://127.0.0.1:4780
```
## Tauri shell: not verified
Needs system packages that were missing on the dev machine and no root was available:
```bash
sudo dnf install webkit2gtk4.1-devel libsoup3-devel librsvg2-devel # Fedora
cd gui/src-tauri && cargo install tauri-cli --locked && cargo tauri dev
```
The shell is ~80 lines: three commands reusing `grove-bridge`, a tray (open / pause-resume / quit),
and close-to-tray. The CSP allows only `self`; the capability file grants `core:default` only.
Expect small compile fixes on the first build. It is intentionally outside the workspace so that
`cargo test` works without webkit installed.
## Not done
- Screenshots/visual QA inside the real Tauri window.
- Side-by-side compare view for `Diverged` (CLI only).
- Native notifications from the Tauri side (the web Notification API is used).
+26
View File
@@ -0,0 +1,26 @@
# Phase 5: resolve, safety, packaging
## Done
- **Resolve** (`grove resolve <worktree> --take-remote | --keep-local | --save-as BRANCH | --compare`,
also in the GUI). Every choice writes a backup ref first (`refs/sync-backup/<machine>/<stamp>/resolve-local/<branch>`
or `resolve-remote/<branch>`). `--keep-local` uses force-with-lease on the observed upstream tip.
`--take-remote` and `--save-as` refuse on a dirty worktree or when ignored files would be overwritten.
`--save-as` needs the bare + worktrees layout. `status --plan` explains what the next pass will do.
Covered by `crates/grove-core/tests/resolve.rs` (4 tests).
- **Size limit**: `sync.max_file_mb` (default 50, 0 = unlimited). Oversized changed files are left out of
the snapshot (reset to their HEAD version, or absent), reported in the pass result and the daemon log.
Covered by `tests/size_limit.rs`.
- **Encrypted files** (`grove secrets init|push|pull|rekey`, age x25519): see `phase4.md`.
- **Packaging**: `cargo build --release --workspace && cargo deb -p grove --no-build` produces
`target/debian/grove_*.deb` (CLI, daemon, systemd *user* unit `/usr/lib/systemd/user/groved.service`).
The package was built; it was **not installed or run**. `dpkg-shlibdeps` is unavailable here, so `$auto`
dependencies were not computed.
## Not done
- AppImage (no `appimagetool`) and Flatpak: not attempted. The Tauri bundle config requests `deb` and
`appimage`, untested.
- Daemon-side mirroring fallback for GitHub (GitHub has no push mirrors; `configure_mirror` returns `Unsupported`).
- Syncing agent sessions (optional item in the plan): not implemented.
- A real two-PC run, a real cross-forge mirror, Secret Service on a desktop, github.com: unverified.