0.1.6: GBrain brains — refreshed after sync, clashes never make a second page

- A vault has a kind on the hub: Obsidian (as before) or GBrain. Set it with
  `lunesync vault kind`, the canvas panel or the window; Lune suggests it when
  it finds gbrain.yml / .gbrain-source. Every change is in the access log.
- GBrain vaults: devices that have `gbrain` (looked for beyond PATH) are asked
  once whether to refresh it after sync. Lune then runs
  `gbrain sync --source <name> --no-pull` in the background after notes arrive
  or are saved; it never holds up syncing. A failed refresh turns the vault
  amber ("GBrain not refreshed") with Retry, also on the canvas.
- Clashes in GBrain vaults: lines both sides added are kept in the one note,
  incoming first. Same lines changed: the incoming version stays, this
  device's waits under Notes to tidy, stored in .git/lune/tidy (never a copy
  file GBrain would index). Applies to syncing, undo, held notes and
  handovers. Held notes moved aside stay red until decided.
- .gbrain-source is kept per device. Obsidian vaults are unchanged.
- SPEC: M8 section and decisions recorded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-16 22:55:18 +07:00
parent ac5dba46df
commit e6c3f008a0
30 changed files with 2169 additions and 101 deletions

View File

@@ -32,6 +32,7 @@ Lune works on **plain folders**. Obsidian, VS Code, an AI agent or a shell scrip
| **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. |
| **GBrain brains** | Mark a vault as a [GBrain](https://github.com/garrytan/gbrain) brain and every device that has `gbrain` refreshes it after notes arrive, so agents answer from the latest notes. Clashes never become a second page: lines both sides added are kept in the one note, and if the same lines changed, the other version waits on its own device under **Notes to tidy** instead of as a copy file. |
| **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. |
@@ -125,6 +126,7 @@ 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.
- **GBrain:** **Mark as GBrain** makes the vault a GBrain brain for the whole team (Lune suggests it when it sees `gbrain.yml`). Where `gbrain` is installed, Lune asks once whether to refresh GBrain after each sync; if a refresh fails, the vault turns amber with **Retry**.
- **Upload:** put a vault that's only on this Mac onto a team, history included. The button shows for the team owner and anyone who manages a vault there. A vault that syncs with its own remote (GitHub, GitLab, Gitea…) is **detached** from it first, so its notes don't end up in two places; that remote keeps its copy as it was. Before anything is made on the team, Lune checks the notes the way the team's hub will: a line that looks like a secret turns red to decide (replace it with where to find it, or mark it not a secret), and if older history has one, you can upload just the current notes (the full history stays on your Mac).
- **Join another team:** add a second hub, such as your workplace's. **Leave** next to a team removes this Mac from it (anything unshared is handed over first).
@@ -146,6 +148,7 @@ lunesync checkpoint "Before the migration" # a named point in history, shared
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 gbrain --vault Brain --refresh on # refresh GBrain after sync on this device (--source <name>, --retry)
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
@@ -155,6 +158,7 @@ Team management from the terminal:
```sh
lunesync vault new DevOps # the team owner, or anyone who manages a vault
lunesync vault kind Brain gbrain # a GBrain brain for the whole team (or: obsidian)
lunesync vault detach Brain # stop syncing with its own remote (GitHub, GitLab…); stays on this device
lunesync vault upload Brain # put a vault that's only on this device onto the team
lunesync invite Alice --vault DevOps:edit --vault Notes:read
@@ -191,6 +195,7 @@ Such a vault still shows in the Lune app with its status, but not on a team canv
| 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` |
| Kind | Obsidian | **GBrain** changes how clashes are kept (no copy files, see above) and lets devices refresh GBrain after sync. `lunesync vault kind Brain gbrain` |
### Per device