diff --git a/UPSTREAM_CONTRIBUTIONS.md b/UPSTREAM_CONTRIBUTIONS.md index 9592ab28..4f1a6aff 100644 --- a/UPSTREAM_CONTRIBUTIONS.md +++ b/UPSTREAM_CONTRIBUTIONS.md @@ -27,11 +27,15 @@ If you have push access to the repository: ### For Contributors (No Push Access) If you don't have push access: -- Create a branch for your changes +- Make your changes (on any branch, even main/master) - Open Git Management → Pull Request tab - Fill out title/description - Click "Fork & Create PR" -- Shakespeare forks the repo, pushes your branch, and creates the 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." @@ -51,33 +55,100 @@ git clone https://github.com/upstream-org/project.git - Use AI assistance or manual code editing - Test your changes -### 3. Create a Branch +### 3. Commit Your Changes (Optional) -- Open Git Management dialog (click Git status in header) -- Go to "Branches" tab +> **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`, `add-feature`) +- Name it something descriptive (e.g., `fix-typo`) -### 4. Commit Your Changes - -- Go to "Changes" tab to review your modifications -- All changes are automatically staged -- Commit message will be in the PR - -### 5. Create Pull Request +### 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) -### 6. Done! +### 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 @@ -133,7 +204,7 @@ The system provides clear visual feedback: ### Fork Notice ``` -ℹ️ You don't have push access to this repository. +ℹ️ 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. ``` @@ -186,21 +257,25 @@ Tokens are stored locally in browser IndexedDB and never sent to Shakespeare ser ## Example Workflow -Contributing a bug fix to an open source project: +Contributing a bug fix to an open source project (the easy way): -1. **Clone**: `git clone https://github.com/facebook/react.git` -2. **Branch**: Create `fix-useEffect-bug` branch -3. **Edit**: Make your fixes in Shakespeare -4. **PR Tab**: Open Git Management → Pull Request -5. **Fill form**: +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` -6. **Submit**: Click "Fork & Create PR" -7. **Result**: - - Fork created at `yourusername/react` - - Branch pushed to `yourusername/react:fix-useEffect-bug` - - PR opened: `facebook/react:main` ← `yourusername:react:fix-useEffect-bug` +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