Skip to content

feat: Git repository management commands#533

Merged
tlongwell-block merged 1 commit into
mainfrom
feat/cli-git-repos
May 11, 2026
Merged

feat: Git repository management commands#533
tlongwell-block merged 1 commit into
mainfrom
feat/cli-git-repos

Conversation

@tlongwell-block
Copy link
Copy Markdown
Collaborator

What

Adds three commands to the Sprout CLI for managing git repositories:

  • create-repo — Publish a repository announcement, which triggers the relay to provision a bare git repo on disk. Supports optional metadata: name, description, clone URLs, web URL, and preferred relays.
  • get-repo — Look up a repository by its identifier, optionally scoped to a specific owner.
  • list-repos — List repositories owned by you (or another user).

Also adds build_repo_announcement to the SDK — a typed builder for kind:30617 events with full input validation.

Why

Until now, creating a git repository on a Sprout relay required manually constructing and signing a NIP-34 kind:30617 event. These commands make it a one-liner:

sprout create-repo --id my-project --name "My Project" \
  --clone "https://relay.example.com/git/.../my-project"

Once created, git clone and git push work automatically via the existing Smart HTTP transport and git-credential-nostr auth — no additional setup needed.

Design

Follows the same pattern as every other CLI command:

  1. Validate inputs (CLI layer + SDK layer — defense in depth)
  2. Build a typed Nostr event via the SDK
  3. Sign it through client.sign_event() (which handles NIP-OA injection automatically)
  4. Submit to the relay

Repository announcements are parameterized replaceable events — re-publishing with the same identifier updates the metadata in place rather than creating duplicates.

Clone URLs use the NIP-34 multi-value tag format and accept any URL scheme (http, https, ssh, git, nostr, etc.).

Testing

  • All existing tests pass (SDK: 105, CLI: 48)
  • New tests: 8 SDK builder tests + 7 CLI validation tests
  • Manually verified end-to-end against a local relay: create → clone → push → re-clone round-trip confirmed working

…t-repos)

Adds three CLI commands for git repository management:

- create-repo: Publishes a NIP-34 kind:30617 repo announcement event.
  The relay creates a bare git repo on disk as a side-effect.
- get-repo: Queries kind:30617 by repo identifier (d-tag), optionally
  filtered by owner pubkey.
- list-repos: Queries kind:30617 by author (defaults to self).

SDK addition:
- build_repo_announcement() builder with full NIP-34 tag support
  (d, name, description, clone, web, relays) and input validation.

NIP-OA auth flows automatically through client.sign_event() — no
special per-command handling needed.

Clone URLs use multi-value tag format per NIP-34 spec. Any URL scheme
is accepted (http, https, git, ssh, nostr, etc.).

Includes 8 SDK builder tests + 7 CLI validate_repo_id tests.
@tlongwell-block tlongwell-block merged commit 98030c5 into main May 11, 2026
15 checks passed
@tlongwell-block tlongwell-block deleted the feat/cli-git-repos branch May 11, 2026 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants