- Made handleCopyShakespeareURL async
- Added try-catch for modern clipboard API
- Implemented fallback using document.execCommand for older browsers or insecure contexts
- Fallback creates hidden textarea, selects text, and uses execCommand('copy')
- Improved error handling with better user feedback
- Ensures copy functionality works across different browser environments
- Added Copy icon import from lucide-react
- Created handleCopyShakespeareURL function that:
- Validates that a repository URL exists
- Encodes the URL and formats it as a Shakespeare clone URL
- Copies the formatted URL to clipboard
- Shows success/error toast notifications
- Added button below Git URL input that appears when URL is present
- Button copies the properly formatted Shakespeare clone URL (https://shakespeare.diy/clone?url=...)
- Works with GitHub, GitLab, NostrGit, and any other git repository URL
- Remove unused imports (Badge, PullRequestCheck)
- Fix React Hook dependency warnings by using useCallback
- Replace 'any' types with proper TypeScript interfaces
- Fix unused variable errors by prefixing with underscore
- Remove placeholder comments
- Consolidate duplicate type definitions at module level
- Add proper type definitions for API responses
- Fix const vs let issues
Use double type assertion (as unknown as) to properly convert the discriminated
union type from nip19.decode(). This resolves all TypeScript type compatibility
issues across different versions.
Add explicit type assertion to nip19.decode() result to avoid TypeScript
version differences in discriminated union handling. This ensures consistent
type checking across different TypeScript versions used in CI/CD vs local.
Use positive type guard (decoded.type === 'npub' && typeof decoded.data === 'string')
to properly narrow the union type. TypeScript requires both conditions to infer the
correct type for decoded.data when dealing with discriminated unions.
Use negative type guard (decoded.type !== 'npub') to properly narrow the
union type, allowing TypeScript to infer decoded.data as string when
type is 'npub'. This fixes the type overlap error.
- Fix duplicate useState import in GitManagementDialog
- Add missing hostTokens property to GitSettings in all test files
- Fix type narrowing issues in PullRequestDialog with proper type assertions
- Fix fetch headers to use Record<string, string> type
- Fix credentials type to GitCredential | undefined instead of null
- Fix auth callback to handle undefined credentials
- Fix patchLines array type annotation
- Fix git statusMatrix workdir type assertions
- All TypeScript compilation errors resolved
Removed the "Review" button for Nostr patches since they can't be checked out
as branches. The Nostr git workflow is different:
- Patches are standalone events, not git branches
- Contributors don't push branches to a shared remote
- Repository owners review patches via the Merge dialog which shows the patch
content and commits
For GitHub/GitLab:
- Review button still works (checks out the actual branch)
- Branch exists on remote and can be pulled/checked out
For Nostr:
- Only Merge button shown for repo owners
- Merge dialog displays the patch content for review
- This aligns with NIP-34 workflow where patches are self-contained
Restructured the PR card layout to prevent the Merge button from going off-screen:
- Changed from inline flex layout to stacked layout with separate actions row
- Moved action buttons to their own row below PR info
- Added proper spacing with pl-7 to align with content
- Changed button variants for better visibility (outline instead of ghost)
- Added "View" text to external link button for clarity
- Better wrapping for title and badges with flex-wrap
- Buttons now have consistent sizing and spacing
The actions row only shows when there are actions to display (review/merge or
external link), keeping the layout clean for merged PRs with no actions.
Implemented comprehensive PR management for repo owners across GitHub, GitLab, and Nostr:
**For Repository Owners (viewing their own repos):**
- See ALL incoming PRs/patches from contributors, not just their own
- "Review" button to checkout PR branch and preview changes live
- Merge button to merge PRs directly from UI
- Works for GitHub, GitLab, and Nostr repositories
**For Contributors (viewing others' repos):**
- See only their own PRs/patches
- "Merged" badge displayed when PR has been merged
- State tracking via NIP-34 status events (kind 1630-1633) for Nostr
**PR List Enhancements:**
- Show author (display "you" for own PRs, username for others)
- Color coding: green for open, purple for merged
- Conditional actions based on ownership and state
- Different section titles: "Incoming PRs/Patches" vs "Your PRs/Patches"
**Technical Implementation:**
- Extended usePullRequests to detect repo ownership via pubkey/username
- Query all PRs when user is owner, filter to user's PRs otherwise
- For Nostr: query status events to determine merged/closed state
- Updated MergeDialog to accept pre-filled source/target branches
- Added isOwner and authorPubkey fields to PullRequest interface
This enables full PR workflow in Shakespeare: review, preview, and merge contributions.
Removed the "Announce Repository" button since repository announcement now
happens automatically when creating patches. The button is no longer needed
in the user interface.
Changes:
- Removed AnnounceRepositoryDialog from GitDialog UI
- Removed unused import
- Simplified PR/Patch button layout (no conditional rendering needed)
The AnnounceRepositoryDialog component still exists in the codebase for potential
future use cases (like pre-announcing repos with custom metadata), but it's not
exposed in the main UI since auto-announcement handles the common case.
Fixed the issue where patch creation failed with "branches are identical" error.
The problem was comparing the head branch against local main/master instead of
the remote tracking branch (origin/main). For Nostr git repos, users typically
have local changes that differ from the remote, so we need to compare against
origin/baseBranch to find the unique commits.
Changes:
- Try to resolve origin/<baseBranch> first (e.g., origin/main)
- Fall back to local branch if remote tracking branch doesn't exist
- Log which reference is being used for comparison
- Update error message to show which branches were compared
This ensures patches include all commits that differ from the remote, not just
commits that differ from local main (which might be synced with the feature branch).
Modified patch creation workflow to automatically announce repositories if they
don't exist, eliminating the need for users to manually click "Announce Repository".
Key changes:
- Query for repository announcement before creating patch
- If not found, automatically create and publish kind 30617 event
- Use user's configured relay from Shakespeare settings
- Auto-detect earliest unique commit (euc) from git history
- Show toast notification when auto-announcing
- Fall back to manual announcement if auto-announce fails
The workflow is now seamless:
1. User clicks "Create Patch"
2. System checks for repository announcement
3. If missing, creates it automatically in background
4. Publishes patch with proper references
This ensures patches are always discoverable since the announcement is guaranteed
to exist on the same relay before the patch is published. Users no longer need to
understand the two-step process - it "just works".
Extended usePullRequests hook to fetch and display Nostr patches (kind 1617):
- Parse nostr:// URLs with npub/hex pubkey support
- Query patches created by current user using #a tag filter
- Convert patch events to PullRequest format for unified display
- Extract source/target branches from patch content
Updated GitDialog to show Nostr patches:
- Display "Your Patches" section for Nostr repos (like GitHub/GitLab PRs)
- Show patch title, number (first 8 chars of event ID), and branches
- Remove external link button for Nostr (event references aren't clickable URLs)
Enhanced debugging for troubleshooting patch discovery issues:
- Log repository announcement query filter and results
- Log event coordinates and relay information
- Provide verification instructions after publishing announcements
- Warn when repository announcement not found with helpful context
This helps diagnose why patches aren't showing in NostrHub - likely due to:
1. Repository announcement not published to same relay
2. Different relays between Shakespeare and NostrHub
3. Relay propagation delays
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.
The patch implementation was missing several critical tags required by NIP-34:
1. Added 'r' tag with earliest unique commit (euc) from repository announcement
- This enables clients to subscribe to all patches for a specific repo
- Queries the repository's kind 30617 event to get the euc value
2. Improved patch content format to follow git format-patch style
- Includes proper From/Date/Subject headers
- Lists all unique commits with author info and messages
- Follows standard git patch format for better interoperability
3. Added commit-related tags for stable commit IDs:
- 'commit' tag with current HEAD commit ID
- 'parent-commit' tag with parent commit ID
- 'committer' tag with name, email, timestamp, and timezone
- Additional 'r' tag with commit ID for filtering
4. Query repository announcement for relay hints
- Publishes patches to relays specified in the repo's 'relays' tags
- Falls back to default relay if no announcement found
These changes ensure patches are properly discoverable by other Nostr git clients
and follow the complete NIP-34 specification for patch events (kind 1617).
Section 1: Repository Info
- Git URL with save button
- Current Branch selector with New button
- Sync Status with Pull/Push buttons
- Merge Branch action
Section 2: Pull Requests
- Your Open PRs list (for non-Nostr repos)
- Create PR button
Section 3: Working Directory
- List of changed files with status badges
- Clean state message when no changes
All sections are now in a single card-based layout for better organization and clarity.
- Section 1: Git URL, Current Branch, Sync Status, and Merge Branch action
- Section 2: Your open PRs and Create PR button (collapsible form)
- Section 3: Working directory changes
Changes:
- Replaced tab-based navigation with card-based sections
- Combined repository info, branch management, and sync in first section
- Added PR list showing user's open PRs with status icons
- Made branch manager and PR form collapsible to save space
- Improved visual hierarchy with cards and better spacing