Add repository announcement feature for Nostr git (NIP-34)

Created AnnounceRepositoryDialog component to publish repository announcements
(kind 30617) which are required before patches can be discovered on Nostr git
clients like NostrHub.

Key features:
- Auto-detects earliest unique commit (euc) from git history
- Pre-fills repository ID from remote URL
- Allows adding multiple web URLs, clone URLs, and relays
- Publishes to designated relays with proper NIP-34 tags
- Returns naddr for easy sharing

The dialog is displayed in GitDialog for Nostr remotes, positioned next to the
Create Patch button. This completes the Nostr git workflow:

1. Announce repository (creates kind 30617 with euc tag)
2. Submit patches (creates kind 1617 with 'a' tag referencing announcement)

Without step 1, patches are published but not discoverable since clients query
repositories first, then filter patches by the repository's 'a' tag coordinate.
This commit is contained in:
shakespeare.diy committed 2025-10-15 00:14:41 -05:00
1 parent 4ec49e1308
commit 166c2eb72c
3 files changed
+590 -6

No files matched your search

+24 -6
View File
@@ -58,6 +58,7 @@ import { usePullRequests } from '@/hooks/usePullRequests';
import { cn } from '@/lib/utils';
import { findCredentialsForRepo } from '@/lib/gitCredentials';
import { nip19 } from 'nostr-tools';
import { AnnounceRepositoryDialog } from '@/components/git/AnnounceRepositoryDialog';
import { GitManagementDialog } from '@/components/git/GitManagementDialog';
import { MergeDialog } from '@/components/git/MergeDialog';
import { PullRequestDialog } from '@/components/git/PullRequestDialog';
@@ -1013,12 +1014,29 @@ export function GitDialog({ projectId, children, open, onOpenChange }: GitDialog
</div>
)}
{/* Create PR Button */}
<PullRequestDialog
projectId={projectId}
currentBranch={gitStatus.currentBranch}
remoteUrl={originUrl}
/>
{/* Nostr Git Actions */}
{originUrl.startsWith('nostr://') && (
<div className="flex gap-2">
<AnnounceRepositoryDialog
projectId={projectId}
remoteUrl={originUrl}
/>
<PullRequestDialog
projectId={projectId}
currentBranch={gitStatus.currentBranch}
remoteUrl={originUrl}
/>
</div>
)}
{/* Create PR Button for non-Nostr remotes */}
{!originUrl.startsWith('nostr://') && (
<PullRequestDialog
projectId={projectId}
currentBranch={gitStatus.currentBranch}
remoteUrl={originUrl}
/>
)}
</CardContent>
</Card>
)}