From 7d1437e3ecf92996af0990265c9ef91822369f67 Mon Sep 17 00:00:00 2001 From: Adnan Zahir Date: Thu, 29 Oct 2026 14:10:57 +0700 Subject: [PATCH] README for users: what Lune is, setting it up, options, hosting a hub Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 2 +- README.md | 314 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 315 insertions(+), 1 deletion(-) create mode 100644 README.md diff --git a/CLAUDE.md b/CLAUDE.md index cb750f0..59eb77b 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -12,7 +12,7 @@ Build **only the current milestone** (see SPEC §5–6). Every feature must pass - Implementation details not covered by SPEC (crates, file layout, internal APIs) are yours to choose; mention notable ones briefly. ## Keep it small -- Docs live in two files: this one and `docs/SPEC.md`. Don't create more planning documents, status reports or evidence folders. +- Docs live in two files: this one and `docs/SPEC.md`, plus `README.md` for users (what Lune is and how to use it; keep it in step with what's shipped). Don't create more planning documents, status reports or evidence folders. - No security audits, CVE sweeps, multi-arch packaging or release evidence before Milestone 7. - No microservices, CRDTs, custom VCS, plugin systems or agent integrations. - Tests: cover sync correctness (no lost data, conflicts keep both, byte-exact round trips). Skip ceremony. diff --git a/README.md b/README.md new file mode 100644 index 0000000..d454adf --- /dev/null +++ b/README.md @@ -0,0 +1,314 @@ +# Lune + +**One vault. Every copy current. Access you can take back.** + +Lune keeps shared Markdown vaults (ordinary folders of notes, the kind Obsidian opens) in sync across people, laptops, servers and AI agents. Grant access by dragging a vault onto a person; take it back by pulling the ribbon between them. Lune keeps the history, combines edits and handles the keys for you, so nobody on the team needs to know Git. + +- **Sync you can trust.** Edits reach everyone within seconds. Nothing is ever silently overwritten: if two people change the same lines, both versions are kept. +- **Access as a lifecycle.** Invite, change roles, remove someone from one vault or from the whole team. Their unshared work comes back to you before their copy disappears. +- **Approachable.** A menu-bar app and a web canvas. No terminal needed unless you want one. + +> Lune is in an early pilot. The Mac app isn't signed by Apple yet (see [First open on a Mac](#first-open-on-a-mac)). + +--- + +## What it's for + +- **A team knowledge base** (runbooks, DevOps notes, decisions) that everyone edits in their own editor, without anyone having to learn Git. +- **One person with several machines and agents.** Codex on your laptop and Hermes on a VPS keep reading and writing the same notes. +- **Bringing people in and letting them go cleanly.** When someone leaves, their access ends, their unshared notes are handed back for review, and the copies on their devices are removed. + +Lune works on **plain folders**. Obsidian, VS Code, an AI agent or a shell script just read and write files; nothing needs a plugin. + +## What it can do + +| | | +|---|---| +| **Automatic sync** | Changes are shared after about 5 seconds of quiet (at most 60 seconds while you keep typing). Each burst of edits becomes one history entry, labeled with the device it came from. | +| **Works offline** | Keep editing without a connection; everything goes out when you're back online. | +| **Conflicts keep both** | Edits to different lines are combined on their own. If the same lines changed in two places, the incoming version stays in place and yours is saved next to it as `note (Your Mac's version).md`. Compare them side by side and pick one, in the app or on the canvas. Sync never stops to wait for you. | +| **Secret check** | Before a change leaves your device, Lune looks for things like cloud keys, tokens and private keys. A note with one is held back on your device (marked red) until you replace the secret with a pointer, such as "search prod-deploy in Secrets Manager", or say it isn't a secret. The hub runs the same check. | +| **Runaway guard** | If something deletes or rewrites a large part of a vault at once (about 20% of notes, or 50+), the change is held on that device until its owner chooses **Share anyway** or **Undo**. | +| **Roles** | Each person has **Read**, **Edit** or **Manage** on each vault. A Read member can edit their own copy, but those edits stay on their device. | +| **Taking access back** | Remove someone from a vault: their device makes the folder read-only, hands over anything unshared for a manager to **Keep** or **Discard**, then deletes its copy. Devices that are offline do this when they come back. | +| **Team canvas** | A web page on your hub showing vaults, people and devices. Drag to grant, pull a ribbon to revoke (with Undo), and see who is current, behind, offline, or holding a secret. **Nudge** a device to share now. Works on a phone too. | +| **Several teams** | One device can belong to more than one team's hub, such as your own and your workplace's, each with its own vaults. | +| **Signed updates** | The Mac app updates itself from your hub. Every update is signed by your hub and checked before it's installed. | + +## How it fits together + +``` + your Mac (Lune app) ─┐ + your VPS (lunesync) ─┼──► hub (your server) ◄── teammate's Mac + an agent's machine ──┘ · keeps each vault's history + · accounts, roles, devices, access log + · team canvas at https://your-hub +``` + +- **Hub:** one small server you host (Docker). It holds each vault's history, the team's accounts and memberships, and the access log, and it serves the team canvas. +- **Lune for Mac:** a menu-bar app for people. +- **`lunesync`:** the same sync engine as a command-line tool, for servers, agents, and anyone who prefers a terminal. + +--- + +## Getting started + +### Join a team (Mac) + +1. Open the invite link you were sent. +2. Click **Download Lune for Mac**, open the download, and drag **Lune** to **Applications**. +3. Open Lune. The first time, see [First open on a Mac](#first-open-on-a-mac). +4. Back on the invite page, click **Open Lune to join**. +5. In Lune, check the name for this Mac (your team sees it next to your changes) and where shared vaults should live (default `~/Vaults`), then click **Join**. + +Your vaults arrive in that folder. Open them in Obsidian or any editor; from now on Lune only shows up in the menu bar. + +**Adding another Mac to your account:** sign in to your team's canvas, open **Vaults & people**, and click **Connect this Mac**. No code to copy. + +### First open on a Mac + +Lune isn't signed by Apple yet, so the first time macOS says it can't check the app: + +1. Open **System Settings → Privacy & Security**. +2. Scroll to the message about Lune and click **Open Anyway**. + +You only do this once; updates install without asking again. + +### A server or an agent's machine + +Install the command-line tool (needs [Rust](https://rustup.rs) 1.89 or newer): + +```sh +cargo install --git https://git.senkensha.space/senkensha/lune.git lunesync +``` + +Then either join with an invite, or add the machine to your existing account: + +```sh +# With an invite link (creates your account): +lunesync join https://your-hub/join/XXXX --name "Hermes" + +# Or add it to your account: run `lunesync pair` on a device you already have, then: +lunesync login --hub https://your-hub --code K7QD-4MXA --name "Hermes" + +# Keep syncing in the background (launchd on macOS, systemd on Linux): +lunesync service install +``` + +> The tool is tested on macOS. Linux builds should work but haven't been tested yet. + +### Start a team (host a hub) + +See [Hosting a hub](#hosting-a-hub). The team owner's one-time join link appears in the hub's log on first start. + +--- + +## Using Lune + +### The menu bar + +The moon icon shows how things are: + +| Dot | Means | +|---|---| +| 🟢 green | Everything is shared | +| 🟠 amber | Something is waiting: changes not shared yet, a big change to confirm, a note to tidy, or an update needed | +| ⚪ grey | Offline; changes are saved and will go out later | +| 🔴 red | A note was held back because it may contain a secret | + +The menu has **Open Lune**, **Open team canvas**, **Share now**, **Restart to update** (when a new version is ready), **Uninstall Lune…** and **Quit**. + +### The Lune window + +Lists each vault with its status, and anything that needs you: + +- **A big change is waiting:** **Undo** brings back everything it removed or rewrote; **Share anyway** sends it. +- **A note may contain a secret:** type where the secret really lives and click **Replace**, or click **Not a secret**. +- **A note was changed in two places:** **Compare** shows both versions with the differences highlighted. Keep one, or keep both as separate notes. +- **Join another team:** add a second hub, such as your workplace's. + +### The team canvas + +Open it from the menu (**Open team canvas**), or with `lunesync open`. Managers and the team owner can: + +- **Grant:** drag a vault onto a person. +- **Revoke:** pull the ribbon between them until it snaps. You get an **Undo** for about 8 seconds; nothing reaches their devices before that. +- **Invite person**, change roles, rename devices, **Nudge** a device that's behind, tidy notes changed in two places, review **handovers**, and (team owner only) **Remove from team** or **Restore**. + +Every gesture also has a button in the side panel. Every access change is recorded in the hub's access log. + +### Useful commands + +```sh +lunesync status # how each vault is doing +lunesync checkpoint "Before the migration" # a named point in history, shared now +lunesync held # what's held back here, and how to decide +lunesync tidy # notes kept in two versions +lunesync tidy keep mine notes/plan.md # or: theirs, both +lunesync history # recent changes and which device made them +lunesync open # the team canvas, already signed in +lunesync pair # a one-time code to add another device +``` + +Team management from the terminal: + +```sh +lunesync vault new DevOps +lunesync invite Alice --vault DevOps:edit --vault Notes:read +lunesync grant Alice Notes --role manage +lunesync members DevOps +lunesync remove Alice --vault DevOps # her unshared work comes back as a handover +lunesync handovers # then: lunesync handover show|keep|discard|skip +lunesync device remove "Old laptop" # a lost device: hands over and leaves, then its key stops working +lunesync team remove Alice # owner only: ends everything, account can be restored +lunesync hub log # owner only: the access log +``` + +On a device that belongs to several teams, add `--team ` to say which one. + +### Without a hub + +`lunesync` also syncs a folder through any plain Git remote you already have (GitHub, Gitea, a bare repository over SSH), with the same conflict handling, secret check and runaway guard. There are no accounts or access control in this mode: + +```sh +lunesync add Notes ~/Vaults/Notes --remote git@github.com:you/notes.git +lunesync run +``` + +--- + +## Options + +### Per vault (on the hub) + +| Setting | Default | | +|---|---|---| +| Delete from their devices | on | When someone is removed, their copy is deleted after their unshared work is handed over. Off: their copy stays, read-only and no longer synced. `lunesync vault set DevOps --delete-from-devices off` | + +### Per device + +| | | +|---|---| +| Device name | Shown on everything this device shares. `lunesync device name "Codex"`, or set when joining. Brackets must pair up, e.g. `Mac (work)`. | +| Vaults folder | Where vaults from the hub arrive (default `~/Vaults`). Chosen when connecting the Mac app, or `--vaults-dir` on `join` / `login`. | +| Settings folder | `~/Library/Application Support/lune` on macOS, `~/.config/lune` on Linux. Set `LUNE_HOME` to use another folder (handy for running two test devices on one machine). | + +### Hub (environment variables) + +| Variable | Default | | +|---|---|---| +| `LUNE_HUB_URL` | `http://localhost:8080` | The public address people and devices use. Use `https://` in production. | +| `LUNE_OWNER_NAME` | `Owner` | Name of the team owner, whose join link is printed on first start. | +| `LUNE_HUB_DATA` | `/data` | Where vault histories, the database and the update-signing key live. | +| `LUNE_HUB_LISTEN` | `0.0.0.0:8080` | Address the hub listens on. | +| `LUNE_RELEASE_PASSWORD` | (asks) | Password of the update-signing key, for `release keygen` / `publish`. | + +--- + +## Hosting a hub + +You need a server with Docker and a domain name. Put the hub behind a reverse proxy that handles HTTPS (Caddy, nginx, Traefik). Example with Caddy: + +```yaml +# compose.yaml +services: + lune: + build: https://git.senkensha.space/senkensha/lune.git # or a local checkout: build: . + restart: unless-stopped + environment: + LUNE_HUB_URL: https://lune.example.com + LUNE_OWNER_NAME: Sen + volumes: + - ./data:/data + caddy: + image: caddy:2 + restart: unless-stopped + ports: ["80:80", "443:443"] + volumes: + - ./Caddyfile:/etc/caddy/Caddyfile + - ./caddy-data:/data +``` + +``` +# Caddyfile +lune.example.com { + reverse_proxy lune:8080 +} +``` + +```sh +docker compose up -d +docker compose logs lune # the owner's one-time join link +``` + +On a small server (around 4 GB RAM), limit the build: `docker compose build --build-arg CARGO_BUILD_JOBS=2`. + +**Back up `./data`.** It holds every vault, the accounts, and the update-signing key. + +### Publishing the Mac app from your hub + +The hub offers the app for download and for updates, signed with a key that never leaves your server. + +1. **Once:** create the signing key on the hub, and keep its password safe: + ```sh + docker compose exec lune lunehub release keygen + ``` + Put the public key it prints into `desktop/tauri.conf.json` → `plugins.updater.pubkey`. Apps built from then on trust only that key, so don't lose it. +2. **Each release:** build on a Mac (Apple silicon, with Rust and Node.js): + ```sh + desktop/build.sh 0.2.0 + ``` +3. Copy the two files it prints into the hub's data folder, then sign and publish: + ```sh + docker compose exec lune lunehub release publish 0.2.0 \ + /data/incoming/Lune_0.2.0_aarch64.app.tar.gz /data/incoming/Lune_0.2.0_aarch64.dmg "What changed" + ``` + +Apps pick up the new version when they start, when their window opens, and every few hours. The hub keeps serving the newest version and the one before it; older apps keep saving locally and show **Update Lune to keep syncing**. + +**Several hubs, one key:** a second hub (say, your workplace's) can offer the same signed releases without ever holding the key. Copy the `releases//` folder from the signing hub and run `lunehub release import `. + +--- + +## Security and privacy + +- **Pointers, not secrets.** Vaults are for knowledge, not credentials. Lune holds back anything that looks like a secret, and the hub refuses it too. Write where to get access ("use tsh", "search X in Secrets Manager"). +- **Lune never grants infrastructure access.** It doesn't touch SSH, cloud, repository or deployment permissions; those stay in your existing tools. +- **What the hub knows:** vault contents and history, accounts, roles, device names, the access log, and each device's health (when it last synced and how many changes are waiting; never what they are). +- **Devices** sign in with their own key; the hub stores only a hash of it. Losing a device means removing that one device. +- **The team canvas** has no passwords: you sign in with a one-time link from one of your devices (`lunesync open`) or a short code (`lunesync pair`). +- **Uninstalling** (menu → **Uninstall Lune…**) shares what it can, hands the rest over to your team, removes this Mac from every team, and deletes only the vault folders Lune created. Folders you added yourself, and any folder with changes that couldn't be shared, stay. +- **Known limit:** taking access back can't recall copies someone made elsewhere, or content they already gave to other tools. + +## Limitations + +- The Mac app is for **Apple silicon Macs** (macOS 12+). Intel Macs, Windows and Linux desktop apps aren't available yet; on those, use `lunesync`. +- The Mac app isn't signed or notarized by Apple yet (see [First open on a Mac](#first-open-on-a-mac)). +- No mobile app. The team canvas works in a phone browser for urgent things like revoking access or nudging a device. +- Vaults are whole folders: access can't be limited to part of a vault, and there's no time-limited access yet. + +--- + +## Building from source + +```sh +git clone https://git.senkensha.space/senkensha/lune.git && cd lune +cargo test --workspace # sync, hub and conflict tests +cargo install --path cli # lunesync +(cd web && npm ci && npm run build) # the team canvas, embedded in the hub +cargo build --release -p lunehub # the hub +desktop/build.sh 0.1.1 # the Mac app (macOS, Apple silicon) +``` + +| Folder | | +|---|---| +| `core/` | The sync engine: watching, saving, conflicts, secret check, runaway guard, hub client | +| `cli/` | `lunesync` | +| `hub/` | `lunehub`: accounts, memberships, devices, vault storage, access log, releases | +| `web/` | The team canvas (React), and the Mac app's window | +| `desktop/` | The Mac app (Tauri) | +| `docs/SPEC.md` | How Lune is meant to behave, and every design decision | + +## License + +Not chosen yet.