Skip to content

feat(nip34,nip22): add git-over-nostr collaboration (NIP-34) and NIP-22 comments - #23

Merged
naliyi merged 2 commits into
developfrom
feat/nip34-git-collaboration
Sep 16, 2026
Merged

naliyi merged 2 commits into
developfrom
feat/nip34-git-collaboration

Conversation

@naliyi

@naliyi naliyi commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds nip34: NIP-34 (git stuff) end to end -- repository announcements (kind:30617) and state (kind:30618, both addressable), patches (kind:1617), pull requests (kind:1618) and PR updates (kind:1619), issues (kind:1621), status events (kind:1630-1633) with ResolveStatus/ResolveRevisionStatus helpers implementing the spec's status-resolution rules, user grasp lists (kind:10317), and nostr:// clone URL parsing/building.
  • Adds nip22: NIP-22 (Comment) -- the generic kind:1111 threading note NIP-34 replies build on (scoped to a root event, addressable event, or NIP-73 external identifier). Broken out as its own package since it's not git-specific.
  • Both packages follow this SDK's existing pattern: a dependency-free protocol library (New*/Parse*/Validate* per event kind, sentinel Err* vars) plus a relayreg subpackage that registers relay-side support and event validators. No nip34/client subpackage -- unlike Blossom/ecash, NIP-34 has no second transport to dial; publishing/subscribing goes through the existing generic nip01/relay-client plumbing.
  • Adds utils.FormatATag, the build-side counterpart to the existing ParseATag, used by both new packages to construct "a" tag addresses.
  • README: new "Implemented NIPs" entries, a usage example, and an updated relay-side-concerns package list. CHANGELOG: Unreleased/Added entries.

Test plan

  • just check (build + vet + test) passes across the whole module
  • 41 new unit tests across nip34/nip22 covering New/Parse/Validate round-trips and error paths (wrong kind, malformed addresses/pubkeys/pointers, missing required tags)
  • README's new code example compile-checked standalone against this branch

…22 comments

Adds nip34: repository announcements (30617) and state (30618), patches
(1617), pull requests (1618) and updates (1619), issues (1621), status
events (1630-1633) with ResolveStatus/ResolveRevisionStatus helpers, user
grasp lists (10317), and nostr:// clone URL parsing/building. Replies
follow NIP-22's kind:1111 comment shape, added here as its own nip22
package since other NIPs may want it too.

Both packages follow this SDK's existing split: a dependency-free
protocol library (New*/Parse*/Validate* per event kind, sentinel errors)
plus a relayreg subpackage that registers relay-side support and
validators. There's no nip34/client subpackage -- unlike Blossom/ecash,
NIP-34 has no second transport to dial out to, so publishing/subscribing
goes through the existing generic nip01/relay-client plumbing.

Also adds utils.FormatATag, the build-side counterpart to the existing
ParseATag, needed by both new packages to construct "a" tag addresses.
Replaces the single announce+issue example with one subsection per
nip34 operation: announce a repo and publish its state, submit a
patch series/revision/PR/PR-update, open an issue and thread top-level
and nested replies, set and resolve all four status kinds, publish a
grasp server list, build/parse every nostr:// clone URL form, and
subscribe to a repository's activity (and its replies) from a relay.

Every example was compile-checked and executed standalone against this
branch. That review caught a real bug in the previous example: its
otherPrivateKeyHex literal was 63 hex characters (odd length), which
type-checks fine but panics at runtime in Sign() -- go build/vet alone
would never have caught it.
@naliyi

naliyi commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

Expanded the README's NIP-34 section from one example to one subsection per operation (announce+state, patch series/revision/PR/PR-update, issue+threaded replies, all four status kinds + ResolveStatus/ResolveRevisionStatus, grasp list, all three nostr:// clone URL forms, and subscribing to a repo's activity from a relay).

Every example was compile-checked and run standalone against this branch -- which caught a real bug the original example had: otherPrivateKeyHex was 63 hex chars (odd length). go build/go vet don't catch that since hex decoding only happens at runtime inside Sign(); it would have panicked for anyone who copy-pasted it. Fixed, and now every literal key/ID used during verification was generated and length-checked programmatically rather than hand-typed, to rule out the same class of mistake elsewhere.

@naliyi
naliyi marked this pull request as ready for review September 16, 2026 14:40
@naliyi
naliyi merged commit fdced80 into develop Sep 16, 2026
3 checks passed
@naliyi
naliyi deleted the feat/nip34-git-collaboration branch September 16, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant