mirror of
https://github.com/nostr-protocol/nips.git
synced 2024-11-10 14:19:08 -05:00
new draft of NIP17
This commit is contained in:
parent
133277afe6
commit
cac20740d4
71
17.md
71
17.md
|
@ -1,7 +1,7 @@
|
||||||
NIP-17
|
NIP-17
|
||||||
======
|
======
|
||||||
|
|
||||||
Git Updates and Discovery Over Nostr
|
Git Commits and Discovery Over Nostr
|
||||||
------------------------------------
|
------------------------------------
|
||||||
|
|
||||||
`draft` `optional` `author:melvincarvalho`
|
`draft` `optional` `author:melvincarvalho`
|
||||||
|
@ -11,42 +11,95 @@ Git Updates and Discovery Over Nostr
|
||||||
Do not merge until implemented, work in progress
|
Do not merge until implemented, work in progress
|
||||||
------------------------------------------------
|
------------------------------------------------
|
||||||
|
|
||||||
|
Status: This NIP is an early draft and work in progress. Implementations are being developed which will incorporate what is learnt.
|
||||||
|
|
||||||
|
|
||||||
Introduction
|
Introduction
|
||||||
------------
|
------------
|
||||||
|
|
||||||
Git updates over nostr enable uses cases similar to [github actions](https://github.com/features/actions) / [continuous integration](https://en.wikipedia.org/wiki/Continuous_integration) / [continuous deplyment](https://en.wikipedia.org/wiki/Continuous_deployment) / [travis](https://travis-ci.org/), but without central points of failure. The aim is to create continuous distributed software development processes, without having to rely on complex or centralized services.
|
Git Commits over nostr enable **uses cases** similar to:
|
||||||
|
|
||||||
|
- [github actions](https://github.com/features/actions)
|
||||||
|
- [continuous integration](https://en.wikipedia.org/wiki/Continuous_integration)
|
||||||
|
- [continuous deplyment](https://en.wikipedia.org/wiki/Continuous_deployment)
|
||||||
|
- [travis](https://travis-ci.org/)
|
||||||
|
|
||||||
|
but without central points of failure. The aim is to create continuous distributed software development processes, without having to rely on complex or centralized services.
|
||||||
|
|
||||||
|
**You need only know the nostr ID or bech32 form of a repo you will be able to discover all versions, its origins and its history.**
|
||||||
|
|
||||||
|
The git object data is not designed to be stored in nostr, but rather, the signaling, update, version and commit data. Git data will live in existing git repositories, github, gitlab, gitea, gogs, ssh, file system etc.
|
||||||
|
|
||||||
|
|
||||||
|
New Kind
|
||||||
|
========
|
||||||
|
|
||||||
A special event with kind `17`, can be used to indicate git commit messages. This number was selected to be hopefully easy to remember : `G-1-7`.
|
A special event with kind `17`, can be used to indicate git commit messages. This number was selected to be hopefully easy to remember : `G-1-7`.
|
||||||
|
|
||||||
Git events *could* be displayed as a text note (kind=1) too, but they are unlikley to mix well with human readable notes, so that motivates git events having its own kind, and even specialist relays.
|
|
||||||
|
|
||||||
The git object data is not designed to be stored in nostr, but rather, the signaling, update, version and commit data.
|
New Tag
|
||||||
|
=======
|
||||||
|
|
||||||
It will also be possible signal a recommended repo, just like it is possible to recommended a relay. In this way, a codebase could start on github, move to gitlab, then to an own hosted instance, and finally back to github. All, without any breaks in service.
|
A new tag "c" will be used to store commit hashes from git a new version of the repo
|
||||||
|
|
||||||
This NIP is an early draft and work in progress. Implementations are being developed which will incorporate what is learnt.
|
|
||||||
|
|
||||||
Event Structure
|
Event Structure
|
||||||
===============
|
===============
|
||||||
|
|
||||||
|
```JSON
|
||||||
|
{
|
||||||
|
"id": "32-bytes lowercase hex-encoded sha256 of the the serialized event data",
|
||||||
|
"pubkey": "32-bytes lowercase hex-encoded public key of the repo",
|
||||||
|
"created_at": "git_author_date",
|
||||||
|
"kind": 17,
|
||||||
|
"tags": [
|
||||||
|
["c", "git hash", "recommended git URI"],
|
||||||
|
["e", "previous commit id"]
|
||||||
|
],
|
||||||
|
"content": "arbitrary string",
|
||||||
|
"sig": "64-bytes hex of the signature of the sha256 hash of the serialized event data, which is the same as the id field"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
Git events over nostr have the following attributes:
|
Git events over nostr have the following attributes:
|
||||||
|
|
||||||
**`content`** SHOULD be equal to the hex-encoded git commit hash. Typically this will be a 40 character sha-1 hash, but git will soon be allowing sha-2 hashes too
|
**`created_at`** SHOULD be equal to git *author date*. This is the same number format as nostr.
|
||||||
|
|
||||||
**`created_at`** SHOULD be equal to git *author date*. This is the same format as nostr.
|
**`tags`** MUST contain tag "c" which is equal to the hex-encoded git commit hash. Typically this will be a 40 character sha-1 hash, but git will soon be allowing sha-2 hashes too
|
||||||
|
|
||||||
**`tags`** MAY contain an entry identifying the previous commit, if one exists, in the form `["e", "<event_id>"]`. Further tags can be developed to capture informative git information such as major/minor versioning. TBD: it will be possible to hint at a recommended git URL to download the repos (e.g. from github), but it is not yet decided whether this would be a tag itself or an additional entry in an existing tag.
|
MAY contain an entry identifying the previous commit, if one exists, in the form `["e", "<event_id>"]`. Further tags can be developed to capture informative git information such as major/minor versioning. TBD: it will be possible to hint at a recommended git URL to download the repos (e.g. from github), but it is not yet decided whether this would be a tag itself or an additional entry in an existing tag.
|
||||||
|
|
||||||
**`pubkey`** SHOULD be associated with a given repo. This could be communicated out of band, or, for example MAY be included in a file in the root directory of the repo, `nostr.json`
|
**`pubkey`** SHOULD be associated with a given repo. This could be communicated out of band, or, for example MAY be included in a file in the root directory of the repo, `nostr.json`
|
||||||
|
|
||||||
|
**`content`** empty, reserved for future use
|
||||||
|
|
||||||
|
Repo Discovery
|
||||||
|
===============
|
||||||
|
|
||||||
|
It will also be possible signal a recommended repo, just like it is possible to recommended a relay. In this way, a codebase could start on github, move to gitlab, then to an own hosted instance, and finally back to github. All, without any breaks in service. TODO: flesh out this section, perhaps include relay discovery, and bech32 encoding
|
||||||
|
|
||||||
|
|
||||||
|
nostr.json
|
||||||
|
==========
|
||||||
|
|
||||||
|
The design of this NIP is such that each repo will have a public key used to send updates to a relay. That key SHOULD appear in the top level directory of the repo in a file called `nostr.json`
|
||||||
|
|
||||||
```JSON
|
```JSON
|
||||||
{
|
{
|
||||||
"pubkey": "abcd123..."
|
"pubkey": "abcd123..."
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Extensions
|
||||||
|
==========
|
||||||
|
|
||||||
|
The current NIP is designed to do one thing well. It can be combined with other NIPs to provide more holistic solutions in future.
|
||||||
|
|
||||||
|
|
||||||
Related Work
|
Related Work
|
||||||
============
|
============
|
||||||
|
|
||||||
- http://git.jb55.com/git-nostr-tools/file/README.txt.html
|
- http://git.jb55.com/git-nostr-tools/file/README.txt.html
|
||||||
|
- https://github.com/fiatjaf/git-remote-nostr
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user