This commit is contained in:
2026-09-14 09:05:57 +07:00
parent c6ada10afa
commit 9fbd1c9dfa
4 changed files with 166 additions and 59 deletions
+19 -17
View File
@@ -1,6 +1,6 @@
# Local repository NIP-34 detection
Status: Phases 13 implemented. Phases 45 pending.
Status: Phases 14 implemented. Phase 5 optional and pending.
## Motivation
@@ -235,25 +235,27 @@ stays a thin renderer.
- `ToolingOnly` → "Nostr tooling" (muted)
- plain → unchanged warning icon.
Note: the announced-open path currently opens the announced repository without the local worktree;
attaching it is Phase 4.
A matched entry opens the announced repository; Phase 4 attaches its local worktree.
### Phase 4 — detail view: open as announced, gate the publish CTA
- [ ] `crates/signed_state/src/repo.rs`: add a constructor that keeps the worktree path while in
NIP-34 mode, e.g. `RepoStore::from_worktree(addr, announcement, path, cx)`, or a small
`set_path`. `RepoStore::announce` already keeps an existing path, so this can be built from
`new` plus assigning the path. Opening a repository must **not** remove it from
`LocalReposStore` (that removal belongs to `apply_announcement`, which only runs on a real
publish).
- [ ] `crates/workspace/src/views/repo/mod.rs`: add `RepoDetailView::new_local_announced(...)`
(or an `Option<Announcement>` parameter on `new_local`) that builds the announced store with
the local worktree attached, then `new_common`.
- [ ] `crates/workspace/src/views/sidebar/mod.rs`: route local-entry clicks through the new
constructor when an announcement matched, and through `open_local_repo` otherwise.
- [ ] `crates/workspace/src/views/repo/mod.rs`: for a `new_local` view whose store carries an
`Initialized` binding, suppress the "publish to NIP-34" call to action and instead show the
owner and identifier. `Cloned` keeps the ability to be adopted/published.
Implemented.
- [x] `crates/signed_state/src/repo.rs`: `RepoStore::from_worktree(addr, announcement, path, cx)`
builds the announced store and attaches the local path. `RepoStore` gained a `nip34` field
carrying the detected binding, and `new_local` now takes it.
- [x] `crates/workspace/src/views/repo/mod.rs`: `RepoDetailView::new_local_announced(...)` builds the
announced store with the local worktree, then `new_common`. `new_local` gained an
`Option<Nip34Binding>` parameter.
- [x] `crates/workspace/src/views/repo/mod.rs` (`load_repo`): a store with a local path now loads the
worktree from that path even when it is announced, instead of always using the cached mirror.
This is what actually attaches the local worktree; previously the announced branch ignored
`RepoStore::path` and cloned into the mirror.
- [x] `crates/workspace/src/views/sidebar/mod.rs`: local-entry clicks route through
`open_local_announced` when an announcement matched, and `open_local_repo` otherwise.
- [x] `crates/workspace/src/views/repo/mod.rs` (`render_local_header`): an `Initialized` binding
suppresses the "Initialize on Nostr" call to action and shows the owner and identifier
instead. `Cloned` and `ToolingOnly` keep the publish path.
### Phase 5 — optional: mark Signed's own publications