feat(nip34,nip22): add git-over-nostr collaboration (NIP-34) and NIP-22 comments - #23
Conversation
…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.
|
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: |
Summary
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) withResolveStatus/ResolveRevisionStatushelpers implementing the spec's status-resolution rules, user grasp lists (kind:10317), andnostr://clone URL parsing/building.nip22: NIP-22 (Comment) -- the generickind:1111threading 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.New*/Parse*/Validate*per event kind, sentinelErr*vars) plus arelayregsubpackage that registers relay-side support and event validators. Nonip34/clientsubpackage -- unlike Blossom/ecash, NIP-34 has no second transport to dial; publishing/subscribing goes through the existing genericnip01/relay-clientplumbing.utils.FormatATag, the build-side counterpart to the existingParseATag, used by both new packages to construct"a"tag addresses.Test plan
just check(build + vet + test) passes across the whole modulenip34/nip22covering New/Parse/Validate round-trips and error paths (wrong kind, malformed addresses/pubkeys/pointers, missing required tags)