diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-03-05 10:10:05 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-03-05 10:10:05 +0000 |
| commit | 93c3e5fa18bc5ffb39b4e28b7b7b38bb6ce3fd93 (patch) | |
| tree | d68cc1b2a1aa0d895f16ab1919dca29fb51648f8 | |
| parent | 7ed33d9539a7232ca17b8c42e67b9f9d708acea3 (diff) | |
improve ngit skill: description, --json guidance, dedup auth
- rewrite description in third person
- add machine-readable output section with --json guidance
- add grep pattern for is_nostr_repo check (no jq dependency)
- remove duplicate auth section, point to CONCEPT 5
- add verification steps to workflows
| -rw-r--r-- | skills/ngit/SKILL.md | 57 |
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 | --- |
| 2 | name: ngit | 2 | name: ngit |
| 3 | description: 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". | 3 | description: 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. |
| 4 | license: CC-BY-SA-4.0 | 4 | license: CC-BY-SA-4.0 |
| 5 | metadata: | ||
| 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 | ||
| 28 | Before running any `ngit` commands, check whether the current directory is a nostr repository: | 34 | Before running any `ngit` commands, check whether the current directory is a nostr repository: |
| 29 | 35 | ||
| 30 | ```bash | 36 | ```bash |
| 31 | ngit repo --json | 37 | ngit repo --json --offline |
| 32 | ``` | 38 | ``` |
| 33 | 39 | ||
| 34 | Always exits 0. Returns `{"is_nostr_repo": false}` when not in a nostr repo, or the full repo info when it is. | 40 | Always exits 0. Returns `{"is_nostr_repo": false}` when not in a nostr repo, or the full repo info when it is. |
| 35 | 41 | ||
| 42 | To check without loading the full repo details, grep for the key field: | ||
| 43 | |||
| 44 | ```bash | ||
| 45 | ngit repo --json --offline | grep -q '"is_nostr_repo":true' | ||
| 46 | ``` | ||
| 47 | |||
| 36 | Script usage: | 48 | Script usage: |
| 37 | 49 | ||
| 38 | ```bash | 50 | ```bash |
| 39 | IS_NOSTR=$(ngit repo --json --offline | jq -r '.is_nostr_repo') | 51 | if ngit repo --json --offline | grep -q '"is_nostr_repo":true'; then |
| 40 | if [ "$IS_NOSTR" = "true" ]; then | ||
| 41 | ngit pr list --json | 52 | ngit pr list --json |
| 42 | fi | 53 | fi |
| 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 | ||
| 109 | ngit 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: | 120 | ngit 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) | ||
| 113 | ngit account login | ||
| 114 | |||
| 115 | # Or create a new account | ||
| 116 | ngit account create --name "Your Name" | ||
| 117 | |||
| 118 | # Or pass key inline (for CI/scripts — no prompt) | ||
| 119 | ngit --nsec <nsec> <command> | ||
| 120 | ``` | ||
| 121 | |||
| 122 | Credentials are stored as git config keys (`nostr.nsec`, `nostr.npub`, etc.) and can be set directly: | ||
| 123 | |||
| 124 | ```bash | ||
| 125 | # Global (all repos) | ||
| 126 | git config --global nostr.nsec <nsec> | ||
| 127 | |||
| 128 | # Local (this repo only) | ||
| 129 | git 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) |
| 475 | ngit repo --json --offline | jq -r '.nostr_url' | 465 | ngit 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" | |||
| 487 | git push -u origin pr/fix-typo \ | 478 | git 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 | ||
| 482 | ngit 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 |
| 496 | ngit pr list | 489 | ngit pr list --json |
| 497 | 490 | ||
| 498 | # Review the PR | 491 | # Review the PR |
| 499 | ngit pr view <ID> --comments | 492 | ngit pr view <ID> --json --comments |
| 500 | 493 | ||
| 501 | # Check it out and test locally | 494 | # Check it out and test locally |
| 502 | ngit pr checkout <ID> | 495 | ngit pr checkout <ID> |
| @@ -506,6 +499,8 @@ ngit pr checkout <ID> | |||
| 506 | git checkout main | 499 | git checkout main |
| 507 | git merge pr/my-feature | 500 | git merge pr/my-feature |
| 508 | git push origin main | 501 | git push origin main |
| 502 | # Verify the PR is now closed/applied | ||
| 503 | ngit 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 | |||
| 515 | ngit issue create --title "Crash on startup" \ | 510 | ngit 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 | ||
| 514 | ngit issue list --json --offline | ||
| 518 | 515 | ||
| 519 | # Later, close it | 516 | # Later, close it |
| 520 | ngit issue close <ID> | 517 | ngit issue close <ID> |
| 518 | # Verify it is closed | ||
| 519 | ngit issue view <ID> --json --offline | ||
| 521 | ``` | 520 | ``` |
| 522 | 521 | ||
| 523 | ### Workflow: Non-interactive / CI scripting | 522 | ### Workflow: Non-interactive / CI scripting |