upleb.uk

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

summaryrefslogtreecommitdiff
path: root/skills
diff options
context:
space:
mode:
Diffstat (limited to 'skills')
-rw-r--r--skills/ngit/SKILL.md57
1 files changed, 28 insertions, 29 deletions
diff --git a/skills/ngit/SKILL.md b/skills/ngit/SKILL.md
index a492d28..918f310 100644
--- a/skills/ngit/SKILL.md
+++ b/skills/ngit/SKILL.md
@@ -1,7 +1,9 @@
1--- 1---
2name: ngit 2name: ngit
3description: Use when working with nostr:// git repositories, submitting or reviewing pull requests (PRs) or patches over Nostr, creating or viewing git Nostr issues, cloning a nostr:// URL, publishing a repo to Nostr with ngit init, or any task involving the ngit CLI or git-remote-nostr. Triggers include: "ngit", "nostr:// repo", "git nostr", "submit a PR", "submit a patch", "open an issue on nostr", "clone nostr://", "view nostr issues", "ngit init", "push pr/ branch". 3description: Provides commands and workflows for nostr:// git repositories using the ngit CLI and git-remote-nostr. Activates when working with nostr:// remotes or URLs, ngit commands, gitworkshop.dev repositories, submitting or reviewing pull requests (PRs) or patches over Nostr, creating or viewing Nostr git issues, cloning a nostr:// URL, publishing a repository with ngit init, or any task involving the ngit CLI or git-remote-nostr.
4license: CC-BY-SA-4.0 4license: CC-BY-SA-4.0
5metadata:
6 version: "1.0"
5--- 7---
6 8
7# ngit — Nostr Plugin for Git 9# ngit — Nostr Plugin for Git
@@ -23,21 +25,30 @@ This installs two binaries:
23- `ngit` — the main CLI 25- `ngit` — the main CLI
24- `git-remote-nostr` — a git remote helper that enables `nostr://` URLs to work transparently with git 26- `git-remote-nostr` — a git remote helper that enables `nostr://` URLs to work transparently with git
25 27
28## Machine-readable output
29
30**All `ngit` commands support `--json` for structured output. Always use `--json` when scripting or parsing output** — it is far easier to process reliably than human-readable text. Standard `git` commands do not support `--json`; use them as normal.
31
26## Detecting a Nostr Repository 32## Detecting a Nostr Repository
27 33
28Before running any `ngit` commands, check whether the current directory is a nostr repository: 34Before running any `ngit` commands, check whether the current directory is a nostr repository:
29 35
30```bash 36```bash
31ngit repo --json 37ngit repo --json --offline
32``` 38```
33 39
34Always exits 0. Returns `{"is_nostr_repo": false}` when not in a nostr repo, or the full repo info when it is. 40Always exits 0. Returns `{"is_nostr_repo": false}` when not in a nostr repo, or the full repo info when it is.
35 41
42To check without loading the full repo details, grep for the key field:
43
44```bash
45ngit repo --json --offline | grep -q '"is_nostr_repo":true'
46```
47
36Script usage: 48Script usage:
37 49
38```bash 50```bash
39IS_NOSTR=$(ngit repo --json --offline | jq -r '.is_nostr_repo') 51if ngit repo --json --offline | grep -q '"is_nostr_repo":true'; then
40if [ "$IS_NOSTR" = "true" ]; then
41 ngit pr list --json 52 ngit pr list --json
42fi 53fi
43``` 54```
@@ -106,28 +117,7 @@ Anyone can clone using the `nostr://` URL. The remote helper fetches the announc
106 117
107### Authentication 118### Authentication
108 119
109ngit uses your Nostr private key (nsec) for signing events. Credentials are stored in git config (`nostr.nsec`). Login once globally and all repos use it: 120ngit uses your Nostr private key (nsec) for signing events. See [CONCEPT 5: Account Management](#concept-5-account-management) for full details.
110
111```bash
112# Login interactively (stores nsec in global git config)
113ngit account login
114
115# Or create a new account
116ngit account create --name "Your Name"
117
118# Or pass key inline (for CI/scripts — no prompt)
119ngit --nsec <nsec> <command>
120```
121
122Credentials are stored as git config keys (`nostr.nsec`, `nostr.npub`, etc.) and can be set directly:
123
124```bash
125# Global (all repos)
126git config --global nostr.nsec <nsec>
127
128# Local (this repo only)
129git config nostr.nsec <nsec>
130```
131 121
132--- 122---
133 123
@@ -472,7 +462,8 @@ ngit init --name "My Project" --description "A cool project" -d
472# origin is now set to nostr://... and code is pushed 462# origin is now set to nostr://... and code is pushed
473 463
474# Get the canonical nostr:// URL to share (npub + relay hint + identifier) 464# Get the canonical nostr:// URL to share (npub + relay hint + identifier)
475ngit repo --json --offline | jq -r '.nostr_url' 465ngit repo --json --offline
466# Look for the "nostr_url" field in the output
476# e.g. nostr://npub1abc.../relay.ngit.dev/my-project 467# e.g. nostr://npub1abc.../relay.ngit.dev/my-project
477``` 468```
478 469
@@ -487,16 +478,18 @@ git commit -m "fix: correct typo in README"
487git push -u origin pr/fix-typo \ 478git push -u origin pr/fix-typo \
488 -o 'title=Fix typo in README' \ 479 -o 'title=Fix typo in README' \
489 -o 'description=Corrects a spelling mistake in the introduction.\n\nSmall copy fix, no functional changes.' 480 -o 'description=Corrects a spelling mistake in the introduction.\n\nSmall copy fix, no functional changes.'
481# Verify the PR was created
482ngit pr list --json --offline
490``` 483```
491 484
492### Workflow: Review and merge a PR (maintainer) 485### Workflow: Review and merge a PR (maintainer)
493 486
494```bash 487```bash
495# See what's open 488# See what's open
496ngit pr list 489ngit pr list --json
497 490
498# Review the PR 491# Review the PR
499ngit pr view <ID> --comments 492ngit pr view <ID> --json --comments
500 493
501# Check it out and test locally 494# Check it out and test locally
502ngit pr checkout <ID> 495ngit pr checkout <ID>
@@ -506,6 +499,8 @@ ngit pr checkout <ID>
506git checkout main 499git checkout main
507git merge pr/my-feature 500git merge pr/my-feature
508git push origin main 501git push origin main
502# Verify the PR is now closed/applied
503ngit pr view <ID> --json --offline
509``` 504```
510 505
511### Workflow: File and close an issue 506### Workflow: File and close an issue
@@ -515,9 +510,13 @@ git push origin main
515ngit issue create --title "Crash on startup" \ 510ngit issue create --title "Crash on startup" \
516 --body "Reproducible with v2.1 on Linux.\n\nSteps: run ngit init in an empty dir." \ 511 --body "Reproducible with v2.1 on Linux.\n\nSteps: run ngit init in an empty dir." \
517 --label bug 512 --label bug
513# Verify the issue was created and note its ID
514ngit issue list --json --offline
518 515
519# Later, close it 516# Later, close it
520ngit issue close <ID> 517ngit issue close <ID>
518# Verify it is closed
519ngit issue view <ID> --json --offline
521``` 520```
522 521
523### Workflow: Non-interactive / CI scripting 522### Workflow: Non-interactive / CI scripting