diff --git a/FORK_PR_TROUBLESHOOTING.md b/FORK_PR_TROUBLESHOOTING.md deleted file mode 100644 index 94cfa6e0..00000000 --- a/FORK_PR_TROUBLESHOOTING.md +++ /dev/null @@ -1,209 +0,0 @@ -# Fork PR Workflow - Troubleshooting Guide - -## Common Issues and Solutions - -### "Validation Failed" Error - -This error from GitHub usually means the PR can't be created. The system now shows detailed reasons: - -**Common causes:** - -1. **Branch doesn't exist in fork** - - **Solution**: The system now automatically pushes your branch to the fork before creating the PR - - If it still fails, try manually: Git Management → Branches → Push to remote - -2. **No commits on the branch** - - **Error**: "head: No commits between..." - - **Solution**: Make sure you've committed your changes before creating a PR - - Go to Git Management → Changes → Commit your work - -3. **PR already exists** - - **Error**: "A pull request already exists for..." - - **Solution**: Check the upstream repository - you might already have an open PR from this branch - - Update the existing PR instead of creating a new one - -4. **Invalid branch name** - - **Error**: "Reference does not exist" - - **Solution**: Make sure your branch name doesn't have special characters - - Use alphanumeric characters, hyphens, and underscores only - -### "Failed to push branch to your fork" - -**Causes:** - -1. **Branch not committed** - ``` - Error: Failed to push branch 'my-branch' to your fork. - - This usually means: - 1. The branch hasn't been committed yet - 2. Network/authentication issues - ``` - - **Solution**: - - Go to Git Management → Changes tab - - Review your changes - - Commit them before creating a PR - -2. **Authentication issues** - - **Solution**: Check Settings → Git → Make sure your GitHub token is valid - - Token must have `public_repo` scope - - Try re-authenticating if the token expired - -3. **Network/CORS issues** - - **Solution**: Check your internet connection - - Some networks block Git operations - - Try again or use a different network - -### Fork Workflow Steps - -When you create a PR and don't have push access, the system: - -1. **Detects you need a fork** - - Shows: "You don't have push access to this repository" - - Explains: "Your changes will be pushed to your fork at username/repo" - -2. **Checks for existing fork** - - If found: Uses it - - If not found: Creates a new fork - - Waits for fork to be ready (GitHub takes a few seconds) - -3. **Sets up remotes** - - Checks if 'origin' points to your fork - - If not, adds a 'fork' remote - - Determines which remote to use for pushing - -4. **Pushes your branch** - - Pushes current branch to fork - - Uses your GitHub credentials - - Shows detailed error if push fails - -5. **Creates PR** - - Uses format: `yourname:branch` → `upstream:main` - - Enables "maintainer can modify" by default - - Returns PR URL on success - -### Error Message Improvements - -The system now shows much more detailed errors: - -**Before:** -``` -Error: Validation Failed -``` - -**After:** -``` -Validation Failed - -Details: head: No commits between master and yourname:test-branch - -See: https://docs.github.com/rest/pulls/pulls#create-a-pull-request -``` - -**With field errors:** -``` -Validation Failed - -Details: base: Does not exist; -head: Must be formatted as 'owner:branch' - -See: https://docs.github.com/rest/pulls/pulls#create-a-pull-request -``` - -### Debug Checklist - -Before creating a PR, verify: - -- [ ] You've made changes to files -- [ ] Changes are committed (check Git Management → Changes) -- [ ] You're on the correct branch -- [ ] Branch has a valid name (no spaces or special chars) -- [ ] You have valid GitHub credentials (Settings → Git) -- [ ] Your token has `public_repo` scope -- [ ] The upstream repository allows forks -- [ ] The target branch exists in upstream (usually `main` or `master`) - -### Manual Override - -If the automatic workflow fails, you can: - -1. **Fork manually** on GitHub.com -2. **Add fork as remote**: - - Git Management → (manually configure remotes if needed) -3. **Push branch** to fork: - - Use the existing "Create Pull Request" button - - Or push via command line -4. **Create PR** on GitHub.com directly - -### Understanding Remotes - -After forking, your remotes should look like: - -``` -origin → git@github.com:yourname/repo.git (your fork) -upstream → git@github.com:original/repo.git (original repo) -``` - -Or if system adds a fork remote: - -``` -origin → git@github.com:original/repo.git (original) -fork → git@github.com:yourname/repo.git (your fork) -``` - -Both configurations work - the system detects which to use. - -### Still Having Issues? - -Check the browser console (F12 → Console) for detailed logs: - -- `Detected GitHub SSH/HTTPS:` - Shows parsed repository info -- `Pushing branch X to fork Y` - Shows push operation -- `GitHub response status:` - Shows API response codes -- `GitHub API error response:` - Shows full error from GitHub - -These logs will show exactly what's happening and where it's failing. - -### GitHub API Rate Limits - -If you see: - -``` -Error: API rate limit exceeded -``` - -**Solution:** -- Wait an hour (unauthenticated limit: 60 requests/hour) -- Or authenticate with a token (limit: 5000 requests/hour) -- Check Settings → Git to ensure token is configured - -### Fork Already Exists - -If you see: - -``` -Error: fork already exists for this repository -``` - -**This is normal!** The system will use your existing fork. The error is just informational. - -### Repository Owner Can't Fork - -If you own the repository, you can't fork it. You don't need to - you have push access! - -The system should detect this and skip the fork workflow. If you see this error, please report it. - -## Getting Help - -If you encounter an error not covered here: - -1. Check the full error message (now includes details) -2. Look at browser console logs -3. Verify your setup (credentials, branch, commits) -4. Try the manual workflow as a workaround -5. Report the issue with: - - Full error message - - Console logs - - Repository URL (if public) - - Branch name diff --git a/NOSTR_GIT.md b/NOSTR_GIT.md deleted file mode 100644 index 82f538c0..00000000 --- a/NOSTR_GIT.md +++ /dev/null @@ -1,163 +0,0 @@ -# Nostr Git Integration - -Shakespeare supports creating patches for Nostr git repositories following [NIP-34 (git stuff)](https://github.com/nostr-protocol/nips/blob/master/34.md). - -## Overview - -Nostr git is a decentralized approach to code collaboration using Nostr events instead of centralized git hosting platforms. With Nostr git: - -- **Repository announcements** (kind 30617) declare the existence of git repositories -- **Patches** (kind 1617) are submitted as Nostr events, similar to pull requests -- **Anyone can submit patches** without needing push access or creating forks -- **Maintainers review and apply patches** through status events - -## How It Works in Shakespeare - -### 1. Repository URL Format - -Nostr git repositories use a special URL format: - -``` -nostr:/// -``` - -- ``: The repository maintainer's Nostr public key (hex format or npub) -- ``: The repository identifier (d tag, usually kebab-case) - -**Important**: The system expects hex pubkeys but will automatically convert npub to hex if provided. - -Examples: -- `nostr://abc123def456.../my-project` (hex pubkey) -- `nostr://npub1abc123.../my-project` (will be converted to hex) - -### 2. Creating Patches (Pull Requests) - -When you create a "Pull Request" for a Nostr git repository, Shakespeare: - -1. **Detects Nostr git URL** - Recognizes the `nostr://` prefix -2. **Creates patch event** - Generates a kind 1617 event with: - - Patch content (git diff or description) - - Reference to repository announcement (`a` tag) - - Tags for repository owner, patch title, description - - NIP-31 `alt` tag for human-readable description -3. **Publishes to Nostr** - Sends the patch to the repository's designated relays -4. **No forking required** - Unlike GitHub/GitLab, patches go directly to the upstream repo - -### 3. UI Integration - -The existing Pull Request dialog automatically adapts for Nostr git: - -- **Button text**: "Create Patch" instead of "Create Pull Request" -- **No credentials needed**: Uses your Nostr signer (logged-in account) -- **No fork workflow**: Patches are submitted directly -- **Success message**: Shows the Nostr event ID as confirmation - -### 4. Key Differences from GitHub/GitLab - -| Feature | GitHub/GitLab | Nostr Git | -|---------|---------------|-----------| -| Authentication | Personal access token | Nostr signer | -| Fork required | Yes (if no push access) | No | -| Push to remote | Yes | No (patch is in event) | -| PR/Patch format | API-based | Nostr event (kind 1617) | -| Relay/server | Centralized | Decentralized relays | - -## Implementation Details - -### GitHostProvider Interface - -Nostr git is implemented as a `NostrGitProvider` that implements the `GitHostProvider` interface: - -```typescript -class NostrGitProvider implements GitHostProvider { - // Query repository announcements (kind 30617) - async getRepository(owner: string, repo: string): Promise - - // Check if user is a maintainer - async canUserPush(owner: string, repo: string): Promise - - // Create patch event (kind 1617) - async createPullRequest(options: CreatePullRequestOptions): Promise - - // ... other methods -} -``` - -### Patch Event Structure - -Patches follow NIP-34 specifications: - -```json -{ - "kind": 1617, - "content": "", - "tags": [ - ["a", "30617::"], - ["p", ""], - ["t", "root"], - ["t", "root-revision"], - ["subject", ""], - ["description", ""], - ["alt", "Patch proposal for : "] - ] -} -``` - -### Repository Detection - -The system detects Nostr git URLs in multiple places: - -1. **URL parsing** - `detectGitHost()` checks for `nostr://` prefix -2. **Remote info** - Extracts owner (pubkey) and repo (d tag) from URL -3. **Provider creation** - Instantiates `NostrGitProvider` with signer - -## Future Enhancements - -Potential improvements to Nostr git integration: - -- [ ] Generate actual git patches using `git format-patch` -- [ ] Support patch series (multiple commits) -- [ ] Display patch status (open/closed/applied) -- [ ] Show existing patches for a repository -- [ ] Support patch reviews and comments (kind 1621) -- [ ] Apply patches locally for testing -- [ ] Maintainer tools for applying/merging patches - -## Related NIPs - -- **NIP-34**: git stuff (repository announcements, patches, issues) -- **NIP-31**: alt tag for unknown event kinds -- **NIP-22**: Comments (for patch discussions) - -## Example Workflow - -1. **Clone Nostr git repo**: - ```bash - # Repository URL: nostr://abc123.../my-project - git clone https://actual-clone-url.git - ``` - -2. **Make changes and commit**: - ```bash - git checkout -b my-feature - # ... make changes ... - git commit -m "Add new feature" - ``` - -3. **Create patch in Shakespeare**: - - Open Pull Request dialog - - System detects Nostr git URL - - Fill in title and description - - Click "Create Patch" - - Patch is published to Nostr relays - -4. **Maintainer receives patch**: - - Sees patch event on their relays - - Reviews the proposed changes - - Applies or rejects via status events - -## Resources - -- [NIP-34 Specification](https://github.com/nostr-protocol/nips/blob/master/34.md) -- [Nostr Protocol](https://nostr.com) -- [Git Format-Patch](https://git-scm.com/docs/git-format-patch) diff --git a/NOSTR_GIT_DEBUGGING.md b/NOSTR_GIT_DEBUGGING.md deleted file mode 100644 index f94f9ba9..00000000 --- a/NOSTR_GIT_DEBUGGING.md +++ /dev/null @@ -1,270 +0,0 @@ -# Nostr Git Debugging Guide - -## Understanding the Problem - -Patches are being published successfully but not showing up in NostrHub or other Nostr git clients. This is likely a **relay synchronization issue**. - -## How Nostr Git Discovery Works - -1. **Repository Announcement (Kind 30617)** - - Published once per repository (auto-announced on first patch) - - Contains metadata: name, description, clone URLs, relays - - Includes `r` tag with earliest unique commit (euc) - - Has `d` tag with repository identifier - - Coordinate: `30617:<pubkey>:<repo-id>` - -2. **Patches (Kind 1617)** - - Reference repository via `a` tag: `30617:<pubkey>:<repo-id>` - - Include `r` tag with euc for repository-specific filtering - - Published to relays specified in repository announcement - -3. **Discovery Flow** - - Client queries for repositories (kind 30617) - - User selects a repository - - Client queries for patches using `#a` filter: `#a: ["30617:<pubkey>:<repo-id>"]` - -4. **Auto-Announcement (Shakespeare Feature)** - - When creating first patch, repository is auto-announced - - Uses configured relay from settings - - Ensures announcement and patch on same relay - - Eliminates manual "Announce Repository" step - -## The Relay Problem - -**Key Issue**: Events must be on the **same relay** for discovery to work. - -### Scenario: -1. You're connected to `wss://relay.primal.net` in Shakespeare -2. You announce repository → published to `wss://relay.primal.net` -3. You create patch → published to `wss://relay.primal.net` -4. NostrHub is connected to `wss://relay.nostr.band` -5. NostrHub queries `wss://relay.nostr.band` → **finds nothing** - -### Why This Happens: -- Nostr relays don't automatically sync with each other -- Each relay is independent -- Events are only on relays they were explicitly published to -- Relay hints in events are suggestions, not guarantees - -## Debugging Steps - -### Step 1: Check Which Relay You're On - -In Shakespeare, check the current relay: -- Look at bottom of the page or settings -- Default is `wss://relay.primal.net` - -### Step 2: Verify Repository Announcement - -After clicking "Announce Repository", check console logs: - -``` -=== ANNOUNCING REPOSITORY === -Repository ID: git.shakespeare.diy/portfoliux -Owner pubkey: 932614571afcbad4d17a191ee281e39eebbb41b93fac8fd87829622aeb112f4d -Event coordinate: 30617:932614571afcbad4d17a191ee281e39eebbb41b93fac8fd87829622aeb112f4d:git.shakespeare.diy/portfoliux -Published repository announcement to Nostr relays -To verify: Query for kind 30617 with authors=[...] and #d=[...] -``` - -### Step 3: Verify Patch Can Find Repository - -When creating a patch, check console logs: - -**If repository exists:** -``` -Querying for repository announcement with filter: {...} -Repository announcement query returned 1 events ✅ GOOD -Found repository announcement event: {...} -``` - -**If repository doesn't exist (auto-announce):** -``` -Repository announcement query returned 0 events -Repository announcement not found - creating one automatically -Auto-creating repository announcement: {...} -Successfully auto-announced repository ✅ GOOD -``` - -**If auto-announce fails:** -``` -Repository announcement query returned 0 events -Failed to auto-announce repository: <error> ❌ BAD -``` - -### Step 4: Check NostrHub's Relay - -1. Open NostrHub (nostrhub.io) -2. Check which relay it's using -3. Compare with Shakespeare's relay - -## Solutions - -### Solution 1: Use Same Relay as NostrHub - -1. In Shakespeare settings, change relay to match NostrHub -2. Common NostrHub relays: - - `wss://relay.nostr.band` - - `wss://relay.damus.io` -3. Re-announce repository on this relay -4. Create new patch - -### Solution 2: Publish to Multiple Relays - -When announcing repository, add multiple relays: -- `wss://relay.primal.net` -- `wss://relay.nostr.band` -- `wss://relay.damus.io` - -The announcement event will be published to all of these, and patches will follow. - -### Solution 3: Use NIP-65 Relay Lists (Future Enhancement) - -Proper solution would be to: -1. Query user's NIP-65 relay list -2. Publish repository announcements to all user's read/write relays -3. Patches automatically go to same relays - -## Verifying Success - -### Check Repository is Discoverable: - -1. Open NostrHub -2. Go to Repositories page -3. Look for your repository -4. If found → announcement is on correct relay ✅ - -### Check Patches are Discoverable: - -1. Find your repository on NostrHub -2. Click into repository -3. Check Patches tab -4. Your patches should appear ✅ - -## Common Issues - -### Issue: "Repository announcement not found" -**Cause**: Announcement not on current relay -**Fix**: Re-announce on current relay - -### Issue: Patches published but not visible -**Cause**: Patches on different relay than announcement -**Fix**: Ensure both announcement and patches on same relay - -### Issue: Works in Shakespeare but not NostrHub -**Cause**: Different relays -**Fix**: Use same relay in both clients - -### Issue: Relay hints not working -**Explanation**: Relay hints are suggestions only - clients may ignore them -**Fix**: Ensure announcement is on relay the client uses - -## Event Format Reference - -### Repository Announcement (Kind 30617) -```json -{ - "kind": 30617, - "content": "", - "tags": [ - ["d", "git.shakespeare.diy/portfoliux"], - ["name", "Portfoliux"], - ["description", "Portfolio website"], - ["clone", "nostr://npub.../git.shakespeare.diy/portfoliux"], - ["relays", "wss://relay.nostr.band"], - ["r", "abc123...", "euc"] - ] -} -``` - -### Patch Event (Kind 1617) -```json -{ - "kind": 1617, - "content": "From abc... Mon Sep 17...\n<git format-patch content>", - "tags": [ - ["a", "30617:932614571afcbad4d17a191ee281e39eebbb41b93fac8fd87829622aeb112f4d:git.shakespeare.diy/portfoliux"], - ["p", "932614571afcbad4d17a191ee281e39eebbb41b93fac8fd87829622aeb112f4d"], - ["t", "root"], - ["t", "root-revision"], - ["subject", "Fix bug in component"], - ["r", "abc123..."], - ["commit", "def456..."], - ["parent-commit", "ghi789..."] - ] -} -``` - -## Testing Relay Synchronization - -To test if events are on a relay: - -1. **Using nostr.band explorer:** - - Go to https://nostr.band - - Search for your event ID or repository coordinate - - Check which relays have the event - -2. **Using console in Shakespeare:** - ```javascript - // Check repository announcement - await nostr.query([{ - kinds: [30617], - authors: ["your-pubkey"], - "#d": ["your-repo-id"], - limit: 1 - }]); - - // Check patches - await nostr.query([{ - kinds: [1617], - "#a": ["30617:your-pubkey:your-repo-id"], - limit: 10 - }]); - ``` - -## Recommended Workflow - -### Simplified (Auto-Announce Enabled) - -1. **Configure relay** (one time): - - Settings → Select relay (e.g., `wss://relay.nostr.band`) - - This relay will be used for all Nostr git operations - -2. **Create patches** (automatic announcement): - - Click "Create Patch" - - System automatically announces repository if needed - - Patch is published with proper references - - Check "Your Patches" section to verify - -3. **View in NostrHub:** - - Ensure NostrHub uses same relay - - Browse to Repositories → Find your repository - - View patches in Patches tab - -### Manual (If Auto-Announce Fails) - -1. **First time setup:** - - Switch to `wss://relay.nostr.band` (widely used) - - Click "Announce Repository" button - - Verify announcement succeeded - -2. **Creating patches:** - - Ensure same relay as announcement - - Create patch - - Check console for successful repository lookup - - Verify patch appears in "Your Patches" section - -3. **Checking in NostrHub:** - - Ensure NostrHub on same relay - - Browse to Repositories - - Find your repository - - View patches - -## Future Improvements Needed - -1. **Multi-relay publishing**: Publish to multiple relays automatically -2. **NIP-65 integration**: Use user's relay list -3. **Relay fallback**: Try multiple relays when querying -4. **Relay selection UI**: Easy relay switching before operations -5. **Event verification**: Confirm events were published successfully -6. **Cross-relay search**: Query multiple relays for better discovery diff --git a/UPSTREAM_CONTRIBUTIONS.md b/UPSTREAM_CONTRIBUTIONS.md deleted file mode 100644 index 4f1a6aff..00000000 --- a/UPSTREAM_CONTRIBUTIONS.md +++ /dev/null @@ -1,308 +0,0 @@ -# Contributing to Upstream Projects - -Shakespeare's Git management system now supports contributing to upstream open source projects through automatic forking, even if you don't have push access to the repository. - -## How It Works - -When you try to create a pull request to a repository where you don't have push permissions, Shakespeare automatically: - -1. **Detects your permissions** via the Git host API (GitHub/GitLab) -2. **Checks for an existing fork** under your account -3. **Creates a fork** if one doesn't exist -4. **Configures the PR** to use your fork as the source -5. **Creates the pull request** from `your-fork:branch` → `upstream:main` - -This all happens transparently - you just fill out the PR form and click create. - -## User Experience - -### For Repository Owners (Have Push Access) - -If you have push access to the repository: -- Create branches normally -- Push changes directly -- Create PRs within the same repository -- Standard workflow - nothing changes - -### For Contributors (No Push Access) - -If you don't have push access: -- Make your changes (on any branch, even main/master) -- Open Git Management → Pull Request tab -- Fill out title/description -- Click "Fork & Create PR" -- Shakespeare automatically: - - Creates a feature branch (if you're on main/master) - - Forks the repo (if needed) - - Pushes your branch - - Creates the PR - -You'll see a message like: -> "You don't have push access to this repository. Your changes will be pushed to your fork at **username/repo** and a pull request will be created from there." - -## Step-by-Step Guide - -### 1. Clone an Upstream Repository - -```bash -# Clone any open source project in Shakespeare -git clone https://github.com/upstream-org/project.git -``` - -### 2. Make Your Changes - -- Edit files in Shakespeare -- Use AI assistance or manual code editing -- Test your changes - -### 3. Commit Your Changes (Optional) - -> **Note:** You can skip this step! If you're on the main/master branch, a feature branch will be created automatically when you create the PR. - -If you want to create a branch manually: - -- Open Git Management → "Branches" tab -- Click "Create Branch" -- Name it something descriptive (e.g., `fix-typo`) - -### 4. Create Pull Request - -- Go to "Pull Request" tab -- Select target branch (usually `main` or `master`) -- Enter PR title and description -- If you're on main/master: You'll see "A feature branch will be automatically created from your PR title" -- Click "Fork & Create PR" (or just "Create Pull Request" if you have access) - -### 5. Done! - -- Your fork is created automatically -- Changes are pushed to your fork -- PR is opened from fork to upstream -- You get a link to view the PR - -## Automatic Feature Branch Creation - -### Why? - -Most users will make changes directly on the `main` or `master` branch without realizing they should create a feature branch first. To make contributing easier, Shakespeare automatically creates a feature branch for you when needed. - -### When Does This Happen? - -When you create a PR and you're currently on `main` or `master`, the system: - -1. **Generates a branch name** from your PR title - - Converts to lowercase - - Replaces spaces with hyphens - - Removes special characters - - Adds a unique suffix (timestamp-based) - -2. **Creates the branch** from your current position - -3. **Checks it out** automatically - -4. **Continues with PR creation** on the new branch - -### Example - -**Your PR title:** "Fix login button styling" - -**Generated branch:** `fix-login-button-styling-k7m2` - -**What happens:** -``` -Before: You're on 'main' with uncommitted changes -After: You're on 'fix-login-button-styling-k7m2' with the same changes -Result: PR created from the feature branch → upstream/main -``` - -### UI Indicators - -You'll see these messages when on main/master: - -**Alert Box:** -> You're on the **main** branch. A feature branch will be automatically created from your PR title for this contribution. - -**Branch Comparison:** -``` -upstream/repo:main ← main -Note: A new branch will be created automatically -``` - -**Toast Notification:** -> Feature branch created -> Created branch 'fix-login-button-styling-k7m2' for your changes - -### What If You Want to Use Your Own Branch? - -Simple! Just create a branch manually first: - -1. Git Management → Branches tab -2. Click "Create Branch" -3. Name it whatever you want -4. Now create your PR - no auto-branch will be created - -### Benefits - -- **No Git knowledge needed** - Users don't need to understand branching -- **Best practices enforced** - Never commit directly to main -- **Clean history** - Each PR gets its own branch -- **Easy to understand** - Branch names match PR titles -- **Safe** - Your main branch stays clean - -## Behind the Scenes - -### Permission Detection - -```typescript -// Checks via API if user can push -const canPush = await checkPushPermissions(repo, token); - -if (!canPush) { - // Fork workflow - const fork = await ensureFork(repo, token); - // Use fork_owner:branch as head ref -} -``` - -### Fork Management - -- **Checks existing forks first** - doesn't create duplicates -- **Waits for fork to be ready** - GitHub/GitLab need time to fork -- **Configures head ref properly** - `username:branch` format for cross-repo PRs - -### API Calls - -**GitHub:** -- `GET /repos/{owner}/{repo}` - Check permissions -- `GET /repos/{username}/{repo}` - Check if fork exists -- `POST /repos/{owner}/{repo}/forks` - Create fork -- `POST /repos/{owner}/{repo}/pulls` - Create PR with cross-fork head - -**GitLab:** -- `GET /projects/{id}` - Check permissions (access_level >= 30) -- `GET /projects/{username}/{repo}` - Check if fork exists -- `POST /projects/{id}/fork` - Create fork -- `POST /projects/{id}/merge_requests` - Create MR - -## Supported Platforms - -| Platform | Fork Detection | Fork Creation | Cross-Fork PR | Status | -|----------|---------------|---------------|---------------|--------| -| GitHub | ✅ | ✅ | ✅ | Full | -| GitLab | ✅ | ✅ | ✅ | Full | -| Codeberg | ✅ | ✅ | ✅ | Full | -| Gitea | ✅ | ✅ | ✅ | Full | - -## UI Indicators - -The system provides clear visual feedback: - -### Permission Check -``` -⏳ Checking repository permissions... -``` - -### Fork Notice -``` -ℹ️ You don't have push access to this repository. - Your changes will be pushed to your fork at username/repo - and a pull request will be created from there. -``` - -### Branch Comparison -Shows the full fork relationship: -``` -upstream/repo:main ← username/repo:feature-branch -``` - -### Create Button -Changes based on permissions: -- **Direct access**: "Create Pull Request" with PR icon -- **Fork needed**: "Fork & Create PR" with fork icon - -## Authentication - -Uses existing Shakespeare Git credentials: - -1. **GitHub OAuth** - One-click authentication (Settings → Git) -2. **Personal Access Tokens** - Manual token entry for any platform - -Required token scopes: -- **GitHub**: `public_repo` (for public repositories) -- **GitLab**: `api` or `write_repository` - -Tokens are stored locally in browser IndexedDB and never sent to Shakespeare servers. - -## Troubleshooting - -### "No credentials found" -- Add your Git credentials in Settings → Git -- Make sure the token has the right scopes -- Verify the token hasn't expired - -### "Failed to create fork" -- Check if you already have a fork (only one fork per user) -- Ensure your token has fork permissions -- Some organizations disable forking - check repo settings - -### "Permission denied" -- Your token may have expired or been revoked -- Re-authenticate in Settings → Git -- Check token scopes include repository write access - -### Fork exists but PR fails -- Make sure your fork is up to date -- Try pushing your branch manually first -- Check if the branch name conflicts with upstream - -## Example Workflow - -Contributing a bug fix to an open source project (the easy way): - -1. **Clone**: Clone `facebook/react` in Shakespeare -2. **Edit**: Make your fixes (don't worry about branches!) -3. **PR Tab**: Open Git Management → Pull Request -4. **Fill form**: - - Title: "Fix useEffect memory leak in concurrent mode" - - Description: Detailed explanation of the bug and fix - - Target: `main` -5. **Submit**: Click "Fork & Create PR" -6. **Automatic magic**: - - Creates branch: `fix-useeffect-memory-leak-in-concurrent-mode-x7k2` - - Checks out the new branch - - Forks to `yourusername/react` - - Pushes branch to your fork - - Creates PR: `facebook/react:main` ← `yourusername:react:fix-useeffect-memory-leak-in-concurrent-mode-x7k2` - -**Total steps for you:** 3 (clone, edit, submit) -**Total steps Shakespeare handles:** 6 (branch, fork, push, configure remotes, create PR) - -## Integration with Existing Features - -This fork workflow integrates seamlessly with existing Git features: - -- **Branch Management** - Create/switch/delete branches as usual -- **Diff Viewer** - Review changes before creating PR -- **Compare View** - Compare branches and commits -- **Git Credentials** - Uses existing auth system -- **Remote Management** - Works with origin/upstream remotes - -No new settings or configuration needed - it just works when you try to contribute to repos where you don't have push access. - -## Privacy & Security - -- **No server involvement** - All Git operations happen in your browser -- **Local token storage** - Tokens stored in IndexedDB, never sent to Shakespeare -- **Minimal API calls** - Only checks permissions when needed -- **Read-only checks** - Permission detection doesn't modify anything -- **User confirmation** - Always shows what will happen before forking - -## Future Enhancements - -Potential improvements: -- Conflict resolution UI when upstream has changed -- Sync fork with upstream (rebase/merge) -- Multi-commit PRs with better history -- Draft PR support -- PR templates -- Reviewer/assignee selection