Repository navigation
announce publishes the repository state (kind 30618): where each branch is, the signal mirrors pull on - #55
Conversation
…ranch is, the signal mirrors pull on After the 30617 announcement, the same key publishes a NIP-34 repository state: d, HEAD, one refs/heads/<branch> tag per branch with its commit, and the mark again as chain, txo and commit. It is replaceable, so the newest from the trail key says where the repo is now. A mirror subscribes to it and pulls when it changes, checking the named commit against the mark first. The output gains a State: line. Docs in README, SKILL, the start page and the site.
There was a problem hiding this comment.
🟡 Changes recommended
The refactor leaves an unused, redundantly-computed pubkey declaration in buildAnnouncement that should be removed, though the feature itself is correct and well-tested.
1 open issue
What changed in this PR
This PR implements issue #54 by extending git mark announce to publish a NIP-34 repository state event (kind 30618) immediately after the existing repository announcement (kind 30617), using the same trail key, relays, and created_at. The 30618 event carries the d tag, HEAD, one refs/heads/<branch> tag per branch with its commit, and the latest mark (chain, txo, commit), giving mirrors a replaceable "where the repo is now" sync signal they can watch and verify against the on-chain mark. The event-building logic is refactored so both kinds share a single NIP-01 serialise/hash/sign helper (signEvent).
Changes:
- Added
buildStateandKIND_STATE(30618) inlib/announce.js, factoring the signing step into a sharedsignEventhelper. announce()inbin/git-mark.jsnow publishes the state right after the announcement, listing only failing relays and printing aState: kind 30618 …line.- Added a unit test for
buildStateand updated docs (README, SKILL.md, start.html, index.html).
| File | Description |
|---|---|
| lib/announce.js | Adds buildState/KIND_STATE and extracts shared signEvent; leaves a now-unused pubkey declaration in buildAnnouncement. |
| bin/git-mark.js | Imports buildState and publishes the 30618 state after the 30617 announcement, printing the new State: line. |
| test/git-mark.test.js | Adds coverage for buildState tags, signature, and bare-case output. |
| README.md | Documents the new state event in the command table and Announce section. |
| SKILL.md | Updates the announce command description to mention the repository state. |
| start.html | Updates step 3 narrative and its Check for the new State: output line. |
| index.html | Updates the command table entry for git mark announce. |
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
The change touches cryptographic event signing and the keyholder "one-writer" sync protocol, where subtle correctness issues warrant final human review despite the clean, well-tested diff.
No open issues 🎉
1 resolved since last review
Review effort: Balanced
|
Released in gitmark 0.0.84. |

Closes #54.
git mark announce(and--announce, andgitmark.announce true) now publishes two events with the trail key, to the same relays:d,HEADasref: refs/heads/<branch>, onerefs/heads/<name>tag per branch with its commit, and the mark aschain,txo,commit.The state is replaceable, so the newest one from the key says where the repo is now. That is the sync signal for mirrors: subscribe to 30618 from the pubkey, pull when it changes, and check the named commit against the mark before trusting it. Only the key-holder can replace their own state, which is the one-writer rule.
Code:
buildStatein lib/announce.js besidebuildAnnouncement, with the NIP-01 serialise-hash-sign step shared by both. The announce command publishes the state right after the announcement, with the samecreated_at, and printsState: kind 30618 … (n/m relays); only failing relays are listed a second time. The console keeps reading 30617 and shows nothing different.Tested live from a cold-run agent repo: both events accepted by 3/3 relays, and the 30618 read back from relay.primal.net carries
["refs/heads/gh-pages", <sha>], HEAD, and the chain/txo/commit tags. The ref is one commit past the marked commit, which is the trail-file commitgit markadds after marking, so the two are correctly different.Docs: README (Announce section and command table), SKILL.md, start.html step 3 and its check, index.html command table. 70 tests pass.
Not in this PR: the mirror side, forge pulling on 30618.