|0.0.3||Sep 3, 2023|
|0.0.2||Sep 3, 2023|
|0.0.1||Aug 31, 2023|
#353 in Command line utilities
a proof of concept cli for a nostr based github alternative.
This cli is part of a wider 'Code Collaboration over Nostr' project to establish the use of nostr for code collaboration.
Warning: This project is in an alpha stage so breaking changes in quick succession are very likely. This is proof of concept, expect things not to work. Do not use for production purposes. It currently doesn't encrypt private keys. Use with caution.
- install binary
- browse and clone
browse repositories with
clone hello-world repository with:
gnostr-cli clone -r nevent1qqspg8u2a5ql5w739fyfzq43c2k29h8znpv0xads3njucs63wsd7wyspz3mhxue69uhhyetvv9ujuerpd46hxtnfduu6qm7j
clone gnostr-cli-cli repository with:
gnostr-cli clone -r nevent1qqsql3pzeypfr9e0c3fpnnfm3u5v5h37kmu2q2pxr3mspcuhqy6f78cpz3mhxue69uhhyetvv9ujuerpd46hxtnfduq3qamnwvaz7tmwdaehgu3wwa5kuegm87gy2
gnostr-cli prsto browse open pull requests. Pull to a local branch to see the changes.
- create repository with
- pull, push, pull request and merge
- make a branch off main / master.
- commit with standard
- publish branch and raise a PR with
- pull branch updates with
- merge pr with
gnostr-cli mergewhen on the selected branch
This cli replaces all interaction that would traditionally be done with a remote git server, with a nostr based alternative centered around commits as patches.
Commits, branches, pull requests and merges are all nostr events. Permissions are managed through groups, so multiple maintainers can manage a repository.
Forks are replaced by permissioned branches. This makes it easy for contributors to create PRs and for maintainers and others to review them.
This model reduces the barriers for clients to support repository collaboration. They do not need interact with a git server, clone a repository or download many events. Simply display the
kind 1 messages related to a PR or an issue. The collaboration experience can be enriched further by opting-in to features such as code comments, merging and permissions validation.
Large patches and binaries would need a to be transported separately and referenced in a stub patch event.
Current Supported Commands
- creates a maintainers group event
kind: 40000(see draft NIP)
- creates an admin group event (or uses default)
- creates a repo event
- scaffolds a structure within
.gnostrfolder and adds it to
- initializes git rep
- broadcasts events
- looks for a mapping between local branch and remote
- if it finds a mapping:
- fetches patches and stops if local branch is 'behind' remote
- if it doesn't find a mapping:
- creates a branch maintainers group with the user and the repo maintainers group as members (skips this if the user a repo maintainer)
- creates branch event branch
- if it finds a mapping:
- generates one patch
kind: 410per new commit and broadcasts it
- TODO: enable
--forceso that branches can be rebased. pull needs to be updated to handle this.
- pulls new patches (or patches that have been merged) for the current branch
- check they were issued or merged by a branch maintainer and applies them
- pull new remote branch into a new local branch with option
--branch [hex, nevent or note]
- lists unmerged pull requests in current repository.
- views pull request details and allows users to pull the related branch
- checks user has permission to merge
- merges the current branch into main
- broadcasts a merge event
- creates a merge event which, when applied through ```gnostr-cli pull`` will fast-forward commits onto the target branch
- currently only supports merging to the main branch
- lists a selection of repositories on connected relays
- select and clone
gnostr-cli clone -r [hex, nevent or note]
- clones an gnostr-cli repository
- fetches patches and merges on checkedout branch from relays and reports on the number of commits 'behind' (ie. to pull)
- compares the local checkedout branch to patches that have been pushed and reports on number of commits 'ahead' (ie. to push)
- rebroadcast all locally stored events for a repository to selected relays
- replace the stored private keys with new ones