upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--LICENSE21
-rw-r--r--README.md95
2 files changed, 116 insertions, 0 deletions
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..dfdef63
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
1MIT License
2
3Copyright (c) 2023 DanConwayDev
4
5Permission is hereby granted, free of charge, to any person obtaining a copy
6of this software and associated documentation files (the "Software"), to deal
7in the Software without restriction, including without limitation the rights
8to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9copies of the Software, and to permit persons to whom the Software is
10furnished to do so, subject to the following conditions:
11
12The above copyright notice and this permission notice shall be included in all
13copies or substantial portions of the Software.
14
15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21SOFTWARE. \ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..9241d01
--- /dev/null
+++ b/README.md
@@ -0,0 +1,95 @@
1# ngit cli
2
3a proof of concept cli for a nostr based github alternative.
4
5This cli is part of a wider 'Code Collaboration over Nostr' project to establish the use of nostr for code collaboration.
6
7Warning: 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.
8
9## Getting Started
10
111. install binary
121. browse and clone
13 1. browse repositories with ```ngit clone```
14 1. clone hello-world repository with:
15
16 ```
17 ngit clone -r nevent1qqspg8u2a5ql5w739fyfzq43c2k29h8znpv0xads3njucs63wsd7wyspz3mhxue69uhhyetvv9ujuerpd46hxtnfduu6qm7j
18 ```
19 1. clone ngit-cli repository with:
20
21 ```
22 ngit clone -r nevent1qqsql3pzeypfr9e0c3fpnnfm3u5v5h37kmu2q2pxr3mspcuhqy6f78cpz3mhxue69uhhyetvv9ujuerpd46hxtnfduq3qamnwvaz7tmwdaehgu3wwa5kuegm87gy2
23 ```
24 1. ```ngit prs``` to browse open pull requests. Pull to a local branch to see the changes.
251. create repository with ```ngit init```
261. pull, push, pull request and merge
27 1. make a branch off main / master.
28 1. commit with standard ```git``` command
29 1. publish branch and raise a PR with ```ngit push```
30 1. pull branch updates with ```ngit pull```
31 1. merge pr with ```ngit merge``` when on the selected branch
32
33## Concept Overview
34
35This cli replaces all interaction that would traditionally be done with a remote git server, with a nostr based alternative centered around commits as patches.
36
37Commits, branches, pull requests and merges are all nostr events. Permissions are managed through groups, so multiple maintainers can manage a repository.
38
39Forks are replaced by permissioned branches. This makes it easy for contributors to create PRs and for maintainers and others to review them.
40
41This 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.
42
43Large patches and binaries would need a to be transported separately and referenced in a stub patch event.
44
45### Current Supported Commands
46```ngit init```
47* creates a maintainers group event `kind: 40000` (see draft NIP)
48 * creates an admin group event (or uses default)
49* creates a repo event `kind: 420`
50* scaffolds a structure within `.ngit` folder and adds it to `.gitignore`
51* initializes git rep
52* broadcasts events
53
54```ngit push```
55* looks for a mapping between local branch and remote
56 * if it finds a mapping:
57 * fetches patches and stops if local branch is 'behind' remote
58 * if it doesn't find a mapping:
59 * creates a branch maintainers group with the user and the repo maintainers group as members (skips this if the user a repo maintainer)
60 * creates branch event branch `kind: 410`
61* generates one patch `kind: 410` per new commit and broadcasts it
62* TODO: enable ```--force``` so that branches can be rebased. pull needs to be updated to handle this.
63
64```ngit pull```
65* pulls new patches (or patches that have been merged) for the current branch
66* check they were issued or merged by a branch maintainer and applies them
67* pull new remote branch into a new local branch with option ```--branch [hex, nevent or note]```
68
69```ngit prs```
70* lists unmerged pull requests in current repository.
71* views pull request details and allows users to pull the related branch
72
73```ngit merge```
74* checks user has permission to merge
75* merges the current branch into main
76* broadcasts a merge event
77* creates a merge event which, when applied through ```ngit pull`` will fast-forward commits onto the target branch
78* currently only supports merging to the main branch
79
80```ngit clone```
81* lists a selection of repositories on connected relays
82* select and clone
83
84```ngit clone -r [hex, nevent or note]```
85* clones an ngit repository
86
87```ngit fetch```
88* fetches patches and merges on checkedout branch from relays and reports on the number of commits 'behind' (ie. to pull)
89* compares the local checkedout branch to patches that have been pushed and reports on number of commits 'ahead' (ie. to push)
90
91```ngit rebroadcast```
92* rebroadcast all locally stored events for a repository to selected relays
93
94```ngit change-user```
95* replace the stored private keys with new ones