diff --git a/BRANCH_QUICK_ACCESS_GUIDE.md b/BRANCH_QUICK_ACCESS_GUIDE.md deleted file mode 100644 index c5ca7d7d..00000000 --- a/BRANCH_QUICK_ACCESS_GUIDE.md +++ /dev/null @@ -1,298 +0,0 @@ -# Quick Branch Access Guide - -## ๐ŸŽฏ Overview - -Branch switching and creation are now available directly in the Repository dialog for quick, easy access without opening the Advanced Git Management interface. - ---- - -## ๐Ÿ“ Location - -**Repository Dialog** (click Git status indicator in project header) - -The "Current Branch" card appears at the top of the dialog, right below the header. - ---- - -## โœจ Features - -### 1. Quick Branch Switching - -**How it works:** -1. Open Repository dialog -2. See current branch in dropdown -3. Click dropdown to see all branches -4. Select a branch to switch immediately -5. Project automatically rebuilds - -**Visual indicators:** -- Current branch shown with GitBranch icon -- Checkmark next to current branch in dropdown -- Loading spinner while switching -- Success toast notification - -### 2. Quick Branch Creation - -**How it works:** -1. Open Repository dialog -2. Click "New" button next to branch dropdown -3. Enter branch name in dialog -4. Press Enter or click "Create Branch" -5. New branch is created from current HEAD - -**Validation:** -- Branch name cannot be empty -- Invalid characters rejected (`, ^, :, \, ?, *, [, ]`) -- Clear error messages -- Auto-focus on input field - ---- - -## ๐ŸŽจ UI Layout - -``` -Repository Dialog -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ Repository [Advanced]โ”‚ -โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค -โ”‚ Current Branch โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ [branch dropdown]โ”‚ [New]โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค -โ”‚ Git URL โ”‚ -โ”‚ ... โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ -``` - ---- - -## ๐Ÿ”„ Workflows - -### Switch to Existing Branch - -``` -1. Open Repository dialog -2. Click branch dropdown -3. Select target branch -4. โœ… Branch switched + rebuild triggered -``` - -### Create and Switch to New Branch - -``` -1. Open Repository dialog -2. Click "New" button -3. Enter: feature/my-feature -4. Press Enter or click Create -5. โœ… New branch created -``` - -### Quick Feature Branch - -``` -1. On main branch -2. Open Repository dialog -3. Click "New" -4. Type: feature/add-login -5. โœ… New feature branch ready -``` - ---- - -## ๐Ÿ’ก Tips - -### Keyboard Shortcuts -- **Enter** in branch name field โ†’ Create branch -- **Escape** โ†’ Close create dialog - -### Branch Naming -Good examples: -- `feature/user-authentication` -- `fix/login-bug` -- `docs/api-guide` - -Avoid: -- Spaces: `my feature` โŒ -- Special chars: `feature?new` โŒ -- Empty names โŒ - -### When to Use Quick Access vs Advanced - -**Use Quick Access when:** -- โœ… Switching between known branches -- โœ… Creating a simple feature branch -- โœ… Quick operations during development - -**Use Advanced Git Management when:** -- ๐Ÿ”ง Deleting branches -- ๐Ÿ”ง Viewing remote branches -- ๐Ÿ”ง Comparing branches -- ๐Ÿ”ง Managing multiple branches at once - ---- - -## ๐Ÿ†š Comparison: Quick Access vs Advanced - -| Feature | Quick Access | Advanced | -|---------|-------------|----------| -| Switch branches | โœ… | โœ… | -| Create branches | โœ… | โœ… | -| Delete branches | โŒ | โœ… | -| View remote branches | โŒ | โœ… | -| Branch comparison | โŒ | โœ… | -| Visual branch list | โŒ | โœ… | -| Speed | โšก Fastest | ๐Ÿ”ง Full featured | - ---- - -## ๐ŸŽฏ Use Cases - -### Daily Development - -**Scenario:** Working on multiple features -``` -Morning: Switch to feature/dashboard -Afternoon: Switch to feature/api -Evening: Switch to main for review -``` - -**Actions:** -- Open Repository dialog -- Use branch dropdown -- Switch with one click - -### Starting New Work - -**Scenario:** New feature request -``` -1. Currently on main branch -2. Need: feature/notifications -``` - -**Actions:** -- Open Repository dialog -- Click "New" -- Type: feature/notifications -- Start coding immediately - -### Bug Fix Workflow - -**Scenario:** Production bug reported -``` -1. On feature branch -2. Need to fix bug on main -``` - -**Actions:** -- Switch to main via dropdown -- Click "New" โ†’ hotfix/critical-bug -- Fix and commit -- Switch back to feature branch - ---- - -## โš™๏ธ Behind the Scenes - -### What Happens When You Switch? - -1. **Validation:** Checks if branch exists -2. **Checkout:** Runs `git checkout ` -3. **Status Update:** Refreshes Git status -4. **Rebuild:** Triggers project rebuild -5. **Notification:** Shows success toast - -### What Happens When You Create? - -1. **Name Validation:** Checks for invalid characters -2. **Duplicate Check:** Verifies branch doesn't exist -3. **Resolution:** Gets current HEAD commit -4. **Creation:** Runs `git branch ` -5. **Refresh:** Updates branch list -6. **Notification:** Shows success toast - -**Note:** Creating a branch does NOT automatically switch to it. Use the dropdown to switch after creation if needed. - ---- - -## ๐Ÿ› Troubleshooting - -### "Failed to switch branch" - -**Possible causes:** -- Uncommitted changes in working directory -- Branch doesn't exist -- Git repository error - -**Solutions:** -1. Commit or stash your changes -2. Verify branch exists in dropdown -3. Check Git status in terminal - -### "Failed to create branch" - -**Possible causes:** -- Branch name already exists -- Invalid characters in name -- Not a Git repository - -**Solutions:** -1. Choose a different name -2. Remove special characters -3. Verify Git is initialized - -### Branch list not updating - -**Solution:** -- Close and reopen Repository dialog -- Click "Advanced" and back -- Refresh page if needed - ---- - -## ๐Ÿ“Š Accessibility - -### Keyboard Navigation -- Tab to navigate between elements -- Arrow keys in dropdown -- Enter to confirm actions -- Escape to close dialogs - -### Screen Readers -- Branch selector has proper labels -- Loading states announced -- Success/error messages read aloud - ---- - -## ๐Ÿš€ Performance - -- Branch list loads instantly (< 500ms) -- Switch operation: < 1s -- Create operation: < 500ms -- No network requests (local Git only) - ---- - -## ๐Ÿ”ฎ Future Enhancements - -Planned improvements: -- Branch search/filter in dropdown -- Recent branches section -- Branch descriptions/metadata -- Keyboard shortcuts (Cmd+B for branch switcher) -- Branch creation from specific commit - ---- - -## ๐Ÿ“š Related Documentation - -- **GIT_FEATURES_GUIDE.md** - Full Git features documentation -- **GIT_CLIENT_PROJECT_PLAN.md** - Project roadmap -- **IMPLEMENTATION_SUMMARY.md** - What was delivered - ---- - -*Last Updated: October 14, 2025* -*Feature: Quick Branch Access* -*Version: 1.0.0* diff --git a/GIT_CLIENT_PROJECT_PLAN.md b/GIT_CLIENT_PROJECT_PLAN.md deleted file mode 100644 index d7e73d68..00000000 --- a/GIT_CLIENT_PROJECT_PLAN.md +++ /dev/null @@ -1,922 +0,0 @@ -# Git Client Feature Enhancement Project Plan - -## Executive Summary - -This document outlines a comprehensive plan to enhance Shakespeare's Git capabilities from basic version control to a fully-featured Git client comparable to GitLab/GitHub web interfaces. The project focuses on adding branch management, pull request workflows, merge operations, and advanced Git features while maintaining the browser-based architecture. - ---- - -## Current State Analysis - -### โœ… What's Already Implemented - -**Core Git Operations:** -- โœ… Repository initialization (`git init`) -- โœ… Basic file staging (`git add`) -- โœ… Commits with full history (`git commit`) -- โœ… Push to remote repositories (`git push`) -- โœ… Pull from remote repositories (`git pull`) -- โœ… Fetch from remotes (`git fetch`) -- โœ… Clone repositories (`git clone`) -- โœ… View commit history (`git log`) -- โœ… Check status (`git status`) -- โœ… Diff viewing (`git diff`) -- โœ… Stash changes (`git stash`) -- โœ… Reset operations (`git reset`) -- โœ… Tag management (`git tag`) -- โœ… Remote management (add, remove, list) -- โœ… Configuration (`git config`) - -**Branch Operations (Partial):** -- โœ… List branches (`git branch --list`) -- โœ… Create branches (`git branch `) -- โœ… Delete branches (`git branch -d/-D `) -- โœ… Checkout branches (`git checkout `) -- โœ… Get current branch name -- โœ… Rename branches - -**Advanced Operations:** -- โœ… Merge operations (`git merge`) -- โœ… Find merge base -- โœ… Fast-forward merge -- โœ… Abort merge -- โœ… Object operations (read/write blobs, trees, commits) -- โœ… Packfile operations -- โœ… Git notes -- โœ… Walk operations -- โœ… Resolve/expand refs - -**Nostr Integration:** -- โœ… Push repositories to Nostr (NIP-34) -- โœ… Clone from Nostr URIs -- โœ… Fetch from Nostr -- โœ… Pull from Nostr -- โœ… Repository state events (kind 30618) -- โœ… Repository announcements (kind 30617) - -**UI Components:** -- โœ… `GitDialog` - Main repository dialog with push/pull/sync status -- โœ… `GitStatusIndicator` - Shows uncommitted changes count -- โœ… `GitHistoryDialog` - View commit history and rollback -- โœ… `GitCommit` component - Display commit information -- โœ… Real-time Git status monitoring (updates every 5s) -- โœ… Working directory file changes visualization -- โœ… Remote configuration UI -- โœ… Credential management warnings - -**Developer Experience:** -- โœ… Shell commands for all Git operations -- โœ… TypeScript Git wrapper class -- โœ… React hooks (`useGit`, `useGitStatus`, `useGitSettings`) -- โœ… AI tools for Git operations -- โœ… Comprehensive test coverage - ---- - -## ๐ŸŽฏ Missing Features for Full Git Client - -### 1. **Branch Management UI** ๐ŸŒฟ - -**Missing Capabilities:** -- Visual branch tree/graph -- Branch comparison interface -- Protected branch rules -- Branch creation from specific commits -- Branch merging UI with conflict resolution -- Visual indication of tracking branches -- Upstream branch configuration -- Branch description/metadata - -**Why It Matters:** -Users need to see the relationship between branches, understand which branch tracks which remote, and easily switch between branches without using shell commands. - ---- - -### 2. **Merge & Conflict Resolution** ๐Ÿ”€ - -**Missing Capabilities:** -- Visual merge interface -- Three-way merge view -- Conflict resolution UI (ours vs theirs) -- Interactive merge conflict editor -- Merge strategy selection -- Merge preview (what will change) -- Automatic conflict detection -- Abort merge UI - -**Why It Matters:** -Merge conflicts are inevitable in collaborative work. Without visual conflict resolution, users are blocked and must understand complex Git internals. - ---- - -### 3. **Pull Request / Merge Request Workflow** ๐Ÿ”„ - -**Missing Capabilities:** -- Create pull request from local branch to upstream -- PR description and metadata -- Submit PR to GitHub/GitLab via API -- View open PRs -- Comment on PRs -- Review PR changes -- PR approval workflow -- Merge PR from UI -- PR status indicators -- Fork detection and PR targeting - -**Why It Matters:** -PRs are the cornerstone of collaborative development. Without PR support, Shakespeare can't participate in modern Git workflows on platforms like GitHub/GitLab. - ---- - -### 4. **Diff Visualization** ๐Ÿ“Š - -**Missing Capabilities:** -- Side-by-side diff view -- Inline diff view -- Syntax-highlighted diffs -- Visual diff for images/binary files -- Diff between branches -- Diff between arbitrary commits -- Word-level diff highlighting -- Expandable context lines -- File tree with diff indicators - -**Why It Matters:** -Understanding what changed is fundamental to code review and understanding project evolution. Current diff is text-only without visualization. - ---- - -### 5. **Commit Management** ๐Ÿ“ - -**Missing Capabilities:** -- Amend last commit -- Interactive rebase UI -- Squash commits -- Cherry-pick commits -- Revert specific commits (not just rollback) -- Commit signing (GPG) -- Commit search/filter -- Blame view (git blame) -- Commit graph visualization -- Compare commits - -**Why It Matters:** -Professional workflows require commit manipulation (squashing, amending, cherry-picking) before pushing. Current implementation only supports linear history. - ---- - -### 6. **Remote Repository Browser** ๐ŸŒ - -**Missing Capabilities:** -- Browse remote branches -- View remote commit history -- Compare local vs remote -- Remote tag management -- Multiple remote management UI -- Fetch/pull specific remote branches -- Set tracking branches via UI -- Remote prune (remove stale remote refs) - -**Why It Matters:** -Users need to understand what exists on remotes without pulling everything locally. Current implementation only shows local state. - ---- - -### 7. **Git Submodules** ๐Ÿ“ฆ - -**Missing Capabilities:** -- Add submodules -- Update submodules -- Initialize submodules -- Remove submodules -- Submodule status -- Recursive submodule operations -- Submodule branch tracking - -**Why It Matters:** -Many projects use submodules for dependency management. Without support, these projects can't be fully managed in Shakespeare. - ---- - -### 8. **Git LFS (Large File Storage)** ๐Ÿ’พ - -**Missing Capabilities:** -- LFS initialization -- Track large files with LFS -- Pull LFS files -- Push LFS files -- LFS status/prune - -**Why It Matters:** -Projects with large binary assets (images, videos, models) require LFS. Without it, repos with large files become unusable. - ---- - -### 9. **Advanced History & Search** ๐Ÿ” - -**Missing Capabilities:** -- Commit search by message/author/date -- File history across renames -- Find commits that introduced/removed code -- Bisect to find bug-introducing commits -- Filter history by path -- Date range filtering -- Author filtering in UI - -**Why It Matters:** -In large projects, finding specific changes is crucial for debugging and understanding code evolution. - ---- - -### 10. **GitHub/GitLab Integration** ๐Ÿ”— - -**Missing Capabilities:** -- OAuth authentication with GitHub/GitLab -- Repository creation on platforms -- Issue browsing/creation -- CI/CD pipeline visualization -- Release management -- GitHub Actions/GitLab CI integration -- Repository settings management -- Team/collaborator management - -**Why It Matters:** -Most professional development happens on GitHub/GitLab. Deep integration enables Shakespeare to be a complete development environment. - ---- - -### 11. **Git Hooks** ๐Ÿช - -**Missing Capabilities:** -- Pre-commit hooks -- Post-commit hooks -- Pre-push hooks -- Commit message validation hooks -- Hook management UI -- Custom hook scripts - -**Why It Matters:** -Hooks enable automation and policy enforcement (linting, testing, commit message format). Essential for professional workflows. - ---- - -### 12. **Reflog & Recovery** โšก - -**Missing Capabilities:** -- View reflog (reference logs) -- Recover deleted branches -- Recover lost commits -- Reflog search -- Garbage collection awareness - -**Why It Matters:** -Reflog is the safety net for Git. Without it, users can permanently lose work with no recovery option. - ---- - -### 13. **Worktree Management** ๐ŸŒณ - -**Missing Capabilities:** -- Create worktrees -- List worktrees -- Remove worktrees -- Switch between worktrees - -**Why It Matters:** -Worktrees allow working on multiple branches simultaneously without stashing. Powerful for context switching. - ---- - -### 14. **Patch Management** ๐Ÿ“‹ - -**Missing Capabilities:** -- Generate patches -- Apply patches -- Email patches -- Patch series management - -**Why It Matters:** -Some projects still use email-based patch workflows (Linux kernel, Git itself). Required for contributing to these projects. - ---- - -### 15. **Credential Management** ๐Ÿ” - -**Currently:** -- โœ… Basic credential storage in settings -- โœ… Credential lookup by URL -- โš ๏ธ Credentials stored in plain text in localStorage - -**Missing:** -- Encrypted credential storage -- OAuth token refresh -- SSH key management -- Credential helpers -- Multi-account support per platform -- Credential expiry/renewal -- Security warnings for expired credentials - -**Why It Matters:** -Security is paramount. Plain-text credentials are a major security risk. Professional credential management is essential. - ---- - -## ๐Ÿ“‹ Implementation Priority Matrix - -### **Phase 1: Essential Git Workflows (MVP+)** ๐Ÿš€ -*Enable core collaborative development* - -| Feature | Priority | Complexity | Impact | -|---------|----------|------------|--------| -| Branch Management UI | ๐Ÿ”ด Critical | Medium | High | -| Visual Diff View | ๐Ÿ”ด Critical | Medium | High | -| Basic Merge UI | ๐Ÿ”ด Critical | High | High | -| PR Creation (GitHub/GitLab) | ๐Ÿ”ด Critical | High | Very High | -| Commit Comparison | ๐ŸŸก High | Low | Medium | - -**Estimated Time:** 4-6 weeks - ---- - -### **Phase 2: Advanced Collaboration** ๐Ÿค -*Professional team workflows* - -| Feature | Priority | Complexity | Impact | -|---------|----------|------------|--------| -| Conflict Resolution UI | ๐Ÿ”ด Critical | Very High | High | -| PR Review & Comments | ๐ŸŸก High | High | High | -| Commit Amendment | ๐ŸŸก High | Medium | Medium | -| Cherry-pick UI | ๐ŸŸก High | Medium | Medium | -| Remote Branch Browser | ๐ŸŸก High | Medium | Medium | -| Encrypted Credentials | ๐Ÿ”ด Critical | Medium | Very High | - -**Estimated Time:** 6-8 weeks - ---- - -### **Phase 3: Power User Features** โšก -*Advanced Git capabilities* - -| Feature | Priority | Complexity | Impact | -|---------|----------|------------|--------| -| Interactive Rebase | ๐ŸŸข Medium | Very High | Medium | -| Git Blame View | ๐ŸŸข Medium | Medium | Medium | -| Bisect Interface | ๐ŸŸข Medium | High | Low | -| Reflog Viewer | ๐ŸŸก High | Medium | Medium | -| Advanced History Search | ๐ŸŸข Medium | Medium | Medium | -| Git Hooks Management | ๐ŸŸข Medium | High | Medium | - -**Estimated Time:** 6-8 weeks - ---- - -### **Phase 4: Enterprise Features** ๐Ÿข -*Large project support* - -| Feature | Priority | Complexity | Impact | -|---------|----------|------------|--------| -| Git Submodules | ๐ŸŸข Medium | High | Medium | -| Git LFS | ๐ŸŸข Medium | Very High | Medium | -| Worktree Management | ๐Ÿ”ต Low | High | Low | -| Patch Management | ๐Ÿ”ต Low | Medium | Low | -| CI/CD Integration | ๐ŸŸก High | Very High | High | - -**Estimated Time:** 8-12 weeks - ---- - -## ๐ŸŽจ UI/UX Design Principles - -### Design Goals: -1. **Familiar**: Mirror GitHub/GitLab interfaces where users already have muscle memory -2. **Visual**: Graphs, trees, and visual representations over text output -3. **Contextual**: Show relevant information based on current state -4. **Safe**: Confirm destructive actions, provide undo mechanisms -5. **Educational**: Help users learn Git concepts through clear UI - -### Key Components to Build: - -1. **Branch Graph Component** - - Visual tree of branches - - Commit nodes with metadata - - Merge lines showing relationships - - Interactive (click to checkout, compare, etc.) - -2. **Diff Viewer Component** - - Side-by-side or unified view toggle - - Syntax highlighting - - Line-level comments - - Expand/collapse hunks - - File tree navigation - -3. **Merge Conflict Editor** - - Three-pane view (base, ours, theirs) - - Inline conflict markers with actions - - Accept ours/theirs/both buttons - - Line-by-line resolution - - Preview merged result - -4. **PR Creation Dialog** - - Branch selection (source/target) - - Title/description editor - - Reviewers selection (GitHub/GitLab) - - Labels/milestones - - Preview changes - - Conflict detection before creation - -5. **Commit Inspector** - - Full commit details - - Changed files with diffs - - Parent/child navigation - - Cherry-pick/revert actions - - Share commit link - ---- - -## ๐Ÿ”ง Technical Implementation Strategy - -### Architecture Decisions: - -1. **Existing Foundation:** - - Continue using `isomorphic-git` for core Git operations - - Maintain browser-based architecture (no backend required) - - Use IndexedDB via LightningFS for storage - - Keep TypeScript type safety throughout - -2. **New Services Needed:** - - **GitHub/GitLab API Client:** - ```typescript - // src/lib/githubClient.ts - class GitHubClient { - async createPullRequest(options: CreatePROptions): Promise - async listPullRequests(repo: string): Promise - async mergePullRequest(pr: number): Promise - async addComment(pr: number, comment: string): Promise - // ... more PR operations - } - ``` - - **Git Graph Generator:** - ```typescript - // src/lib/gitGraph.ts - class GitGraph { - async buildGraph(commits: GitCommit[]): Promise - async layoutBranches(): Promise - // Visualization helpers - } - ``` - - **Merge Conflict Resolver:** - ```typescript - // src/lib/mergeResolver.ts - class MergeResolver { - async detectConflicts(files: string[]): Promise - async parseConflictMarkers(content: string): Promise - async resolveConflict(file: string, resolution: Resolution): Promise - } - ``` - -3. **State Management:** - - Use TanStack Query for caching Git operations - - Add optimistic updates for Git operations - - Implement WebSocket for real-time collaboration (future) - -4. **Performance Optimization:** - - Lazy-load commit history (pagination) - - Virtual scrolling for large diffs - - Worker threads for diff computation - - Incremental graph rendering - ---- - -## ๐Ÿ›ฃ๏ธ Detailed Implementation Roadmap - -### Week 1-2: Branch Management UI - -**Tasks:** -- [ ] Create `BranchManager` component with tree visualization -- [ ] Implement branch creation dialog -- [ ] Add branch switching with checkout -- [ ] Show local vs remote branch tracking -- [ ] Add branch deletion with safety checks -- [ ] Integrate branch selector into main UI -- [ ] Add branch comparison view -- [ ] Write tests for branch operations - -**Deliverables:** -- Full branch management UI in `GitDialog` -- Visual branch graph showing relationships -- Quick branch switcher in header - ---- - -### Week 3-4: Visual Diff & Comparison - -**Tasks:** -- [ ] Build `DiffViewer` component with syntax highlighting -- [ ] Implement side-by-side diff view -- [ ] Add unified diff view -- [ ] Create file tree with change indicators -- [ ] Implement commit comparison UI -- [ ] Add branch comparison view -- [ ] Support image diffs -- [ ] Add diff export functionality - -**Deliverables:** -- Professional diff viewer component -- Compare any two commits/branches -- Export diffs as patches - ---- - -### Week 5-8: Pull Request Workflow - -**Tasks:** -- [ ] Implement GitHub API client -- [ ] Implement GitLab API client -- [ ] Create PR creation dialog -- [ ] Add PR description editor (Markdown support) -- [ ] Implement fork detection -- [ ] Add PR submission to upstream -- [ ] Create PR list view -- [ ] Add PR detail view with comments -- [ ] Implement PR review UI -- [ ] Add merge PR functionality -- [ ] OAuth flow for GitHub/GitLab - -**Deliverables:** -- Full PR creation from local branches -- PR review and commenting -- Merge PRs from Shakespeare UI - ---- - -### Week 9-10: Merge & Conflict Resolution - -**Tasks:** -- [ ] Create `MergeDialog` component -- [ ] Implement three-way merge view -- [ ] Build conflict editor with markers -- [ ] Add "accept ours/theirs/both" actions -- [ ] Implement manual conflict resolution -- [ ] Add merge preview -- [ ] Create merge strategy selector -- [ ] Add abort merge UI - -**Deliverables:** -- Visual merge interface -- Interactive conflict resolution -- Merge preview before committing - ---- - -### Week 11-12: Credential Security - -**Tasks:** -- [ ] Implement Web Crypto API encryption -- [ ] Migrate credentials to encrypted storage -- [ ] Add OAuth token refresh logic -- [ ] Create credential manager UI -- [ ] Implement SSH key storage -- [ ] Add security warnings -- [ ] Create credential import/export -- [ ] Write migration script for existing credentials - -**Deliverables:** -- Encrypted credential storage -- OAuth token management -- Security audit passed - ---- - -### Week 13-16: Advanced Commit Operations - -**Tasks:** -- [ ] Implement commit amendment UI -- [ ] Create cherry-pick dialog -- [ ] Build interactive rebase UI -- [ ] Add commit squash functionality -- [ ] Implement commit revert -- [ ] Create git blame viewer -- [ ] Add commit signing (GPG) -- [ ] Build commit search/filter - -**Deliverables:** -- Commit manipulation tools -- Git blame integrated into file viewer -- Advanced commit operations - ---- - -### Week 17-20: History & Search - -**Tasks:** -- [ ] Build advanced history search -- [ ] Implement file history across renames -- [ ] Create bisect UI -- [ ] Add reflog viewer -- [ ] Implement date range filtering -- [ ] Add author filtering -- [ ] Create commit graph visualization -- [ ] Build code search in history - -**Deliverables:** -- Powerful history search -- Bisect for finding bugs -- Reflog for recovery - ---- - -### Week 21-24: Remote Management - -**Tasks:** -- [ ] Create remote browser UI -- [ ] Add remote branch viewer -- [ ] Implement remote comparison -- [ ] Add tracking branch configuration -- [ ] Build remote prune UI -- [ ] Create multi-remote UI -- [ ] Add remote fetch configuration -- [ ] Implement partial clone support - -**Deliverables:** -- Complete remote management -- Remote branch browsing -- Multi-remote workflows - ---- - -### Week 25-30: Enterprise Features - -**Tasks:** -- [ ] Implement Git submodules support -- [ ] Add LFS client -- [ ] Create worktree management UI -- [ ] Implement patch generation/application -- [ ] Add CI/CD pipeline visualization -- [ ] Create issue browser -- [ ] Implement release management -- [ ] Add team management UI - -**Deliverables:** -- Submodule support -- LFS for large files -- CI/CD integration -- Issue tracking - ---- - -## ๐Ÿงช Testing Strategy - -### Testing Requirements: - -1. **Unit Tests:** - - All Git operations have test coverage - - UI components tested in isolation - - State management tested - -2. **Integration Tests:** - - End-to-end PR workflows - - Merge conflict scenarios - - Multi-remote operations - -3. **Performance Tests:** - - Large repository handling - - Diff performance with large files - - Graph rendering performance - -4. **Security Tests:** - - Credential encryption validation - - OAuth token handling - - XSS prevention in commit messages - ---- - -## ๐Ÿ“Š Success Metrics - -### Key Performance Indicators: - -1. **Feature Completeness:** - - 90%+ feature parity with GitHub/GitLab web interfaces - - All core Git operations supported in UI - -2. **User Experience:** - - < 200ms response time for UI interactions - - < 2s for diff rendering (99th percentile) - - < 5s for PR creation - -3. **Adoption:** - - 50% of Shakespeare users use Git features - - 25% create PRs from Shakespeare - - Positive user feedback on Git UX - -4. **Reliability:** - - 99.9% operation success rate - - Zero data loss incidents - - < 1% credential security issues - ---- - -## ๐Ÿšง Technical Challenges & Solutions - -### Challenge 1: Browser Git Performance -**Problem:** Large repositories slow in browser -**Solution:** -- Implement shallow clones -- Use IndexedDB efficiently -- Add pagination for history -- Lazy-load commit details - -### Challenge 2: Merge Conflicts in Browser -**Problem:** No filesystem access for merge tools -**Solution:** -- Build custom conflict parser -- Create visual merge editor -- Store conflict resolution in memory -- Apply resolution atomically - -### Challenge 3: OAuth in Browser App -**Problem:** No backend for OAuth callback -**Solution:** -- Use OAuth PKCE flow (no client secret) -- Implement callback page in app -- Store tokens securely with Web Crypto -- Add token refresh logic - -### Challenge 4: GitHub API Rate Limits -**Problem:** Anonymous requests limited -**Solution:** -- Implement authenticated requests -- Cache API responses aggressively -- Show rate limit status to users -- Queue requests to avoid limit - ---- - -## ๐Ÿ” Security Considerations - -### Critical Security Requirements: - -1. **Credential Storage:** - - โŒ **Never** store credentials in plain text - - โœ… Use Web Crypto API for encryption - - โœ… Implement key derivation from user passphrase - - โœ… Add credential expiry and rotation - -2. **OAuth Tokens:** - - โœ… Use PKCE flow (client-side OAuth) - - โœ… Store tokens encrypted - - โœ… Implement automatic refresh - - โœ… Clear tokens on logout - -3. **Git Operations:** - - โœ… Validate all remote URLs - - โœ… Warn on untrusted remotes - - โœ… Sanitize commit messages for XSS - - โœ… Validate Git hooks before execution - -4. **API Requests:** - - โœ… Use CORS properly - - โœ… Validate API responses - - โœ… Implement rate limiting - - โœ… Add request signing for sensitive operations - ---- - -## ๐Ÿ“š Documentation Requirements - -### User Documentation: -- [ ] Git workflow guides -- [ ] PR creation tutorial -- [ ] Merge conflict resolution guide -- [ ] Branch management best practices -- [ ] Video tutorials for key features - -### Developer Documentation: -- [ ] API client architecture -- [ ] Component library for Git UI -- [ ] Testing Git operations -- [ ] Adding new Git commands -- [ ] OAuth integration guide - ---- - -## ๐ŸŽฏ MVP for Phase 1 (6 weeks) - -### Minimum Viable Product Scope: - -**Must Have:** -1. โœ… Visual branch list and switcher -2. โœ… Create/delete branches from UI -3. โœ… Side-by-side diff viewer -4. โœ… Compare commits/branches -5. โœ… Create PR on GitHub (basic) -6. โœ… Basic merge UI - -**Nice to Have:** -- Branch graph visualization -- PR commenting -- Conflict resolution (basic) - -**Success Criteria:** -- Users can manage branches without shell -- Users can create PRs to GitHub -- Users can view diffs visually -- 80% of users prefer UI over shell commands - ---- - -## ๐Ÿš€ Quick Wins (Week 1) - -### Immediate Impact Features: - -1. **Branch Dropdown in Header** (2 hours) - - Show current branch - - List all local branches - - Click to checkout - -2. **"Create PR" Button** (4 hours) - - Detect GitHub remotes - - Show simple form - - Submit via GitHub API - -3. **Visual File Diff** (8 hours) - - Replace text diff with highlighted view - - Side-by-side layout - - Syntax highlighting - -4. **Branch Comparison** (4 hours) - - Select two branches - - Show commit differences - - Show file differences - ---- - -## ๐ŸŽจ Design Mockups Needed - -### Priority UI Mockups: - -1. **Branch Manager** - - Tree/list view toggle - - Branch creation modal - - Merge/compare actions - -2. **Diff Viewer** - - Side-by-side layout - - File tree sidebar - - Syntax highlighting - -3. **PR Creation Dialog** - - Branch selectors - - Description editor - - Change preview - -4. **Merge Conflict Editor** - - Three-pane view - - Conflict markers - - Resolution actions - -5. **Commit Graph** - - Visual branch tree - - Commit nodes - - Interactive navigation - ---- - -## ๐Ÿ“ž Stakeholder Communication - -### Regular Updates: -- Weekly progress reports -- Bi-weekly demos of new features -- Monthly roadmap reviews -- User feedback sessions - -### User Testing: -- Alpha testers for each phase -- Beta program for early access -- Public feedback collection -- Usage analytics monitoring - ---- - -## ๐Ÿ Conclusion - -This project plan transforms Shakespeare from a basic Git-enabled editor into a fully-featured Git client capable of professional workflows. The phased approach ensures continuous delivery of value while building toward comprehensive GitHub/GitLab feature parity. - -**Expected Timeline:** 6-8 months for full implementation -**Team Size:** 2-3 developers recommended -**User Impact:** Enable professional collaborative development entirely in the browser - -**Next Steps:** -1. Review and approve project plan -2. Create detailed designs for Phase 1 UI -3. Set up project board with tasks -4. Begin Week 1 implementation -5. Schedule weekly check-ins - ---- - -*Document Version: 1.0* -*Last Updated: October 14, 2025* -*Author: Shakespeare AI Assistant* diff --git a/GIT_FEATURES_GUIDE.md b/GIT_FEATURES_GUIDE.md deleted file mode 100644 index 2402aeb3..00000000 --- a/GIT_FEATURES_GUIDE.md +++ /dev/null @@ -1,421 +0,0 @@ -# Git Management Features Guide - -## Overview - -Shakespeare now includes a comprehensive Git management interface with advanced features for branch management, visual diffs, pull request creation, and merge operations. These features transform Shakespeare into a fully-featured Git client that works entirely in your browser. - ---- - -## Accessing Git Features - -### Quick Access -- Click the **Git status indicator** in the project header to open the repository dialog -- Click **"Advanced"** button in the repository dialog to access advanced Git management - -### Main Git Dialog -The standard Git dialog provides: -- **Push/Pull** operations -- **Sync status** monitoring -- **Working directory changes** overview -- **Remote URL** configuration -- **Nostr publishing** (for decentralized Git hosting) - -### Advanced Git Management -The advanced dialog provides comprehensive Git features organized in tabs: -- **Branches** - Full branch management -- **Changes** - Visual diff viewer for uncommitted changes -- **Compare** - Compare branches and commits - ---- - -## Feature Details - -### 1. Branch Management ๐ŸŒฟ - -#### Features: -- **Visual branch list** showing local and remote branches -- **Create new branches** from current HEAD with validation -- **Switch branches** with a single click -- **Delete branches** with confirmation -- **Current branch indicator** clearly marked -- **Remote branch tracking** showing origin branches - -#### How to Use: - -**Create a New Branch:** -1. Open Advanced Git Management โ†’ Branches tab -2. Click **"New Branch"** button -3. Enter branch name (e.g., `feature/new-feature`) -4. Click **"Create Branch"** - -**Switch Branches:** -1. Find the branch in the list -2. Click **"Switch"** button -3. Confirm the action - -**Delete a Branch:** -1. Find the branch (cannot be current branch) -2. Click trash icon -3. Confirm deletion in the dialog - ---- - -### 2. Visual Diff Viewer ๐Ÿ“Š - -#### Features: -- **Side-by-side diff view** - See old and new versions side-by-side -- **Unified diff view** - Traditional unified diff format -- **Syntax highlighting** using Prism.js -- **File tree navigation** with change indicators -- **Status badges** (added/modified/deleted) -- **Copy hunks** to clipboard -- **Line-by-line comparison** with context - -#### Supported Languages: -- TypeScript/JavaScript (`.ts`, `.tsx`, `.js`, `.jsx`) -- CSS (`.css`) -- JSON (`.json`) -- Markdown (`.md`) - -#### How to Use: - -**View Uncommitted Changes:** -1. Open Advanced Git Management โ†’ Changes tab -2. Select a file from the file list -3. View diff in split or unified mode -4. Click copy icon to copy code chunks - -**View Mode Options:** -- **Split View** - Side-by-side comparison (default) -- **Unified View** - Traditional +/- diff format - ---- - -### 3. Branch Comparison ๐Ÿ” - -#### Features: -- **Compare any two branches** or commits -- **Commit list** showing differences -- **Files changed** overview -- **Statistics** showing commits ahead/behind -- **Visual diff** for changed files -- **Commit metadata** (author, date, message) - -#### How to Use: - -**Compare Branches:** -1. Open Advanced Git Management โ†’ Compare tab -2. Select **base branch** (e.g., `main`) -3. Select **compare branch** (e.g., `feature/new-feature`) -4. View comparison results: - - **Commits tab** - List of commits in compare branch not in base - - **Files tab** - Visual diff of all changed files - -**Understanding the Stats:** -- **Commits Ahead** (green) - Commits in compare branch not in base -- **Commits Behind** (orange) - Commits in base branch not in compare -- **Files Changed** (blue) - Total number of files with differences - ---- - -### 4. Merge Operations ๐Ÿ”€ - -#### Features: -- **Merge preview** before performing merge -- **Fast-forward detection** for clean merges -- **Commit list** showing what will be merged -- **File change preview** -- **Conflict detection** (basic) -- **Merge success/failure feedback** -- **Automatic rebuild** after merge - -#### How to Use: - -**Merge a Branch:** -1. Open Advanced Git Management โ†’ Branches tab -2. Click **"Merge"** button -3. Select **source branch** to merge from -4. Review merge preview: - - Number of commits to merge - - List of commits - - Files that will change -5. Click **"Merge Branch"** -6. Confirm success or handle conflicts - -**Fast-Forward Merges:** -When the merge can be fast-forwarded (no diverging history), the merge happens without creating a merge commit. This is indicated in the preview. - -**Handling Merge Conflicts:** -If conflicts are detected, you'll see an error message. Currently, conflicts must be resolved manually using the terminal or file editor. - ---- - -### 5. Pull Request Creation ๐Ÿ”„ - -#### Features: -- **GitHub integration** - Create PRs on GitHub -- **GitLab integration** - Create merge requests on GitLab -- **Automatic platform detection** from remote URL -- **Branch comparison** showing what will be merged -- **Title and description** with Markdown support -- **Target branch selection** -- **Success confirmation** with link to PR -- **Credential validation** - -#### Supported Platforms: -- โœ… GitHub (https://github.com) -- โœ… GitLab (https://gitlab.com) - -#### How to Use: - -**Create a Pull Request:** - -1. **Prerequisites:** - - Push your branch to the remote - - Configure credentials in Settings โ†’ Git - - Ensure remote URL is GitHub or GitLab - -2. **Steps:** - - Open Advanced Git Management โ†’ Branches tab - - Click **"Pull Request"** button - - Select target branch (e.g., `main`) - - Enter PR title (required) - - Enter description (optional, Markdown supported) - - Review repository info - - Click **"Create Pull Request"** - -3. **After Creation:** - - Success screen appears with link to PR - - Click **"View Pull Request"** to open in browser - -**PR Title Best Practices:** -- Be concise but descriptive -- Use conventional commit format (optional): - - `feat: Add new feature` - - `fix: Resolve bug in component` - - `docs: Update documentation` - -**PR Description Tips:** -- Explain **what** changed and **why** -- Link to related issues -- Include testing notes -- Use Markdown for formatting (lists, code blocks, etc.) - ---- - -## Keyboard Shortcuts - -Currently, the Git features are mouse-driven. Keyboard shortcuts may be added in future updates. - ---- - -## Workflow Examples - -### Example 1: Feature Branch Workflow - -1. **Create feature branch:** - ``` - Advanced Git โ†’ Branches โ†’ New Branch - Name: feature/add-login - ``` - -2. **Make changes and commit** (via terminal or AI) - -3. **Compare with main:** - ``` - Advanced Git โ†’ Compare - Base: main - Compare: feature/add-login - ``` - -4. **Create pull request:** - ``` - Advanced Git โ†’ Branches โ†’ Pull Request - Title: "Add login functionality" - Description: "Implements user authentication..." - ``` - -5. **After approval, merge:** - ``` - Advanced Git โ†’ Branches โ†’ Merge - Source: feature/add-login - ``` - -### Example 2: Reviewing Changes - -1. **Check uncommitted changes:** - ``` - Advanced Git โ†’ Changes tab - Review each file's diff - ``` - -2. **Compare branches:** - ``` - Advanced Git โ†’ Compare - See all differences before merging - ``` - -3. **View specific commits:** - ``` - Git Dialog โ†’ History (existing feature) - Click any commit to see details - ``` - ---- - -## Troubleshooting - -### "Failed to load branches" -**Cause:** Not a Git repository or Git error -**Solution:** Ensure the project has a `.git` directory. Try `git init` in terminal. - -### "Failed to create pull request" -**Cause:** Missing credentials or API error -**Solution:** -1. Go to Settings โ†’ Git -2. Add credentials for GitHub/GitLab -3. Ensure token has required permissions - -### "Merge conflicts detected" -**Cause:** Conflicting changes in both branches -**Solution:** -1. Use terminal: `git merge ` -2. Manually resolve conflicts in files -3. Stage resolved files: `git add ` -4. Complete merge: `git commit` - -### "No remote configured" -**Cause:** No origin remote set -**Solution:** -1. Open Git Dialog -2. Enter remote URL -3. Click Save - ---- - -## Technical Details - -### Architecture - -**Components:** -- `BranchManager.tsx` - Branch operations and UI -- `DiffViewer.tsx` - Visual diff rendering -- `CompareView.tsx` - Branch comparison -- `MergeDialog.tsx` - Merge operations -- `PullRequestDialog.tsx` - PR creation -- `GitManagementDialog.tsx` - Main container - -**Dependencies:** -- `isomorphic-git` - Git operations in browser -- `prismjs` - Syntax highlighting -- `@nostrify/nostrify` - Nostr integration - -**Storage:** -- IndexedDB via LightningFS -- No server-side storage required - -### Performance - -- **Branch loading:** < 500ms -- **Diff rendering:** < 1s for typical files -- **Merge preview:** < 2s -- **PR creation:** 1-3s (network dependent) - -### Browser Compatibility - -- โœ… Chrome/Edge (recommended) -- โœ… Firefox -- โœ… Safari (with limitations) -- โŒ IE11 (not supported) - ---- - -## Limitations - -### Current Limitations: - -1. **Conflict Resolution:** - - Visual conflict editor not yet implemented - - Must resolve conflicts manually - -2. **Large Files:** - - Diff viewing may be slow for very large files - - Consider external tools for files > 10MB - -3. **History Depth:** - - Some operations limited to last 50-100 commits - - For full history, use terminal - -4. **Rebase/Cherry-Pick:** - - Not yet implemented in UI - - Use terminal for advanced Git operations - -5. **Git LFS:** - - Large File Storage not yet supported - -### Planned Features (Phase 2+): - -- โœจ Visual conflict resolution editor -- โœจ Interactive rebase UI -- โœจ Cherry-pick commits -- โœจ Git blame view -- โœจ Stash management UI -- โœจ Submodule support - ---- - -## API Access for AI Assistants - -The Git features are also available to AI assistants through tools: - -- `GitCommitTool` - Commit changes -- `ShellTool` - Execute git commands -- Various file manipulation tools - -AI assistants can perform all Git operations programmatically while users interact with the visual UI. - ---- - -## Security Notes - -### Credentials: -- Stored in browser localStorage -- **Encryption planned** for future release -- Use personal access tokens, not passwords -- Tokens should have minimal required permissions - -### GitHub Token Permissions: -Required scopes: -- `repo` - Full repository access (for PRs) -- `workflow` - For GitHub Actions (optional) - -### GitLab Token Permissions: -Required scopes: -- `api` - Full API access -- `write_repository` - Push to repos - ---- - -## Feedback and Support - -Found a bug or have a feature request? -- File an issue on the Shakespeare repository -- Provide detailed steps to reproduce -- Include browser version and console errors - ---- - -## Changelog - -### Version 1.0.0 (Phase 1 - Critical Features) -- โœ… Branch management UI -- โœ… Visual diff viewer -- โœ… Branch comparison -- โœ… Merge operations -- โœ… Pull request creation -- โœ… GitHub/GitLab integration - ---- - -*Last Updated: October 14, 2025* -*Shakespeare Version: 1.0.0* diff --git a/IMPLEMENTATION_SUMMARY.md b/IMPLEMENTATION_SUMMARY.md deleted file mode 100644 index ff6084ef..00000000 --- a/IMPLEMENTATION_SUMMARY.md +++ /dev/null @@ -1,90 +0,0 @@ -# Phase 1 Implementation Summary - -## โœ… Completed: Critical Git Client Features - -**Implementation Date:** October 14, 2025 -**Status:** โœ… Complete and Tested -**Commits:** 2 (dad4ce0, a390593) - ---- - -## What Was Built - -### ๐ŸŽฏ Primary Goal -Transform Shakespeare from a basic Git-enabled editor into a fully-featured Git client with a beautiful, clean UI that works from start to finish. - -### โœจ Features Delivered - -#### 1. Branch Management UI ๐ŸŒฟ -- Visual list of local and remote branches -- Create new branches with name validation -- Switch between branches with one click -- Delete branches with confirmation dialog -- Current branch clearly highlighted -- Remote branch tracking indicators -- Commit hash display for each branch - -**Location:** Advanced Git Management โ†’ Branches tab - -#### 2. Visual Diff Viewer ๐Ÿ“Š -- Two view modes: Side-by-side (default) and Unified -- Syntax highlighting for TypeScript, JavaScript, CSS, JSON, Markdown -- File tree navigation with change indicators -- Status badges (added/modified/deleted) -- Copy code hunks to clipboard -- Line number display -- Context lines around changes - -**Location:** Advanced Git Management โ†’ Changes tab / Compare tab โ†’ Files view - -#### 3. Branch Comparison ๐Ÿ” -- Compare any two branches or commits -- Statistics: Commits ahead (green), behind (orange), files changed (blue) -- Two-tab interface: Commits tab and Files tab -- Commit metadata (author, date, hash) -- Relative timestamps - -**Location:** Advanced Git Management โ†’ Compare tab - -#### 4. Merge Operations ๐Ÿ”€ -- Merge preview before execution -- Fast-forward detection -- Shows commits that will be merged -- Files changed preview -- Visual merge direction indicator -- Merge success/failure feedback -- Automatic rebuild after successful merge -- Basic conflict detection - -**Location:** Repository dialog โ†’ Branch Operations - -#### 5. Pull Request Creation ๐Ÿ”„ -- GitHub and GitLab integration (full support) -- Automatic platform detection from remote URL -- Target branch selection -- Title and description (Markdown supported) -- Repository info display -- Credential validation -- Success screen with direct link to created PR -- Error handling with clear messages - -**Location:** Repository dialog โ†’ Branch Operations - ---- - -## Success Criteria Met โœ… - -All Phase 1 goals from the Git Client Project Plan achieved: -- โœ… Branch Management UI -- โœ… Visual Diff Viewer -- โœ… Pull Request Creation -- โœ… Basic Merge UI -- โœ… Clean, beautiful interface -- โœ… Works from start to finish -- โœ… Comprehensive documentation - -**Phase 1 is complete and ready for production use!** - ---- - -*For detailed information, see GIT_FEATURES_GUIDE.md and GIT_CLIENT_PROJECT_PLAN.md* diff --git a/PR_TROUBLESHOOTING_GUIDE.md b/PR_TROUBLESHOOTING_GUIDE.md deleted file mode 100644 index ea6543d8..00000000 --- a/PR_TROUBLESHOOTING_GUIDE.md +++ /dev/null @@ -1,323 +0,0 @@ -# Pull Request Troubleshooting Guide - -## ๐Ÿ” Debugging PR Creation Issues - -When pull request creation fails, follow these steps to diagnose and fix the issue. - ---- - -## Step 1: Check Browser Console - -Open the browser console (F12 โ†’ Console tab) and look for logs when creating a PR: - -### What to Look For: - -``` -Parsing remote URL: -Detected GitHub HTTPS: { owner: '...', repo: '...' } -Creating PR for: { owner, repo, platform, apiUrl } -Found credentials: Yes/No -Creating github PR... -GitHub PR URL: https://api.github.com/repos/... -``` - -### Common Console Messages: - -**โœ… Good:** -``` -Detected GitHub HTTPS: { owner: 'user', repo: 'myrepo' } -Found credentials: Yes -GitHub response status: 201 -GitHub PR created: https://github.com/user/myrepo/pull/123 -``` - -**โŒ Problem: Wrong Platform:** -``` -Detected GitLab HTTPS: { owner: 'user', repo: 'myrepo' } -Failed to get GitLab project: 401 -``` -โ†’ **Fix:** Your GitHub URL is being detected as GitLab. Check URL format. - -**โŒ Problem: No Credentials:** -``` -Found credentials: No -Error: No credentials found for GitHub -``` -โ†’ **Fix:** Add GitHub credentials in Settings โ†’ Git - -**โŒ Problem: Bad Credentials:** -``` -GitHub response status: 401 -GitHub API error: Bad credentials -``` -โ†’ **Fix:** Your token is invalid or expired - ---- - -## Step 2: Verify Remote URL - -### Check Your Remote URL - -1. Open Repository dialog -2. Look at "Git URL" field -3. Verify format matches one of these: - -**GitHub (HTTPS):** -``` -https://github.com/username/repository.git -https://github.com/username/repository -``` - -**GitHub (SSH):** -``` -git@github.com:username/repository.git -``` - -**GitLab (HTTPS):** -``` -https://gitlab.com/username/repository.git -https://gitlab.com/username/repository -``` - -**GitLab (SSH):** -``` -git@gitlab.com:username/repository.git -``` - -### Common URL Issues: - -โŒ **Missing protocol:** -``` -github.com/user/repo -``` -โ†’ Should be: `https://github.com/user/repo.git` - -โŒ **Wrong format:** -``` -https://github.com:user/repo.git -``` -โ†’ Should be: `https://github.com/user/repo.git` (slash not colon) - -โŒ **Extra path components:** -``` -https://github.com/user/repo/tree/main -``` -โ†’ Should be: `https://github.com/user/repo.git` - ---- - -## Step 3: Check Credentials - -### Verify Credentials Exist - -1. Go to Settings โ†’ Git -2. Check "Git Credentials" section -3. Find entry matching your repository host - -### GitHub Credentials - -**Required Format:** -- **URL Pattern:** `github.com` or `https://github.com` -- **Token Type:** Personal Access Token (classic) - -**How to Create GitHub Token:** -1. Go to GitHub.com โ†’ Settings โ†’ Developer settings -2. Personal access tokens โ†’ Tokens (classic) -3. Generate new token (classic) -4. Select scopes: - - โœ… `repo` (full repository access) -5. Copy token -6. Add to Shakespeare: Settings โ†’ Git โ†’ Add Credential - -**Token Format:** -``` -ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -``` - -### GitLab Credentials - -**Required Format:** -- **URL Pattern:** `gitlab.com` or `https://gitlab.com` -- **Token Type:** Personal Access Token - -**How to Create GitLab Token:** -1. Go to GitLab.com โ†’ Settings โ†’ Access Tokens -2. Add new token -3. Select scopes: - - โœ… `api` (full API access) - - โœ… `write_repository` -4. Create token -5. Copy token -6. Add to Shakespeare: Settings โ†’ Git โ†’ Add Credential - -**Token Format:** -``` -glpat-xxxxxxxxxxxxxxxxxxxx -``` - ---- - -## Step 4: Test Credential Matching - -The credential matcher looks for: - -1. **Exact domain match:** `github.com` matches `https://github.com/user/repo.git` -2. **Full URL match:** `https://github.com` matches `https://github.com/user/repo.git` - -### Debug Credential Matching: - -Check console for: -``` -Remote URL: https://github.com/user/repo.git -Found credentials: Yes -``` - -If "Found credentials: No": -- Add credential with URL pattern: `github.com` -- Or use full URL: `https://github.com` - ---- - -## Step 5: Common Error Messages - -### "Failed to create pull request | Failed to get GitLab Project: 401" - -**Cause:** GitHub URL detected as GitLab, or bad GitLab credentials - -**Fix:** -1. Check console: What platform was detected? -2. If detected as GitLab but should be GitHub: - - Verify URL format: `https://github.com/user/repo.git` - - No typos in domain name -3. If correctly detected as GitLab: - - Check GitLab token validity - - Verify token has `api` scope - -### "No credentials found for GitHub" - -**Cause:** No matching credential in settings - -**Fix:** -1. Go to Settings โ†’ Git -2. Add credential: - - URL: `github.com` - - Token: Your GitHub personal access token -3. Try PR creation again - -### "GitHub API error: Bad credentials" - -**Cause:** Invalid or expired token - -**Fix:** -1. Generate new GitHub token -2. Update credential in Settings โ†’ Git -3. Try again - -### "GitHub API error: 404 Not Found" - -**Cause:** Repository doesn't exist or token doesn't have access - -**Fix:** -1. Verify repository exists: `https://github.com/owner/repo` -2. Check token has access to this repository -3. Verify owner/repo names are correct - -### "Validation Failed" - -**Cause:** PR already exists or branch names invalid - -**Fix:** -1. Check if PR already exists for this branch -2. Verify source and target branches exist -3. Ensure branches are different - ---- - -## Step 6: Manual API Test - -Test your credentials directly: - -### GitHub Test: - -```bash -curl -H "Authorization: token YOUR_TOKEN" \ - https://api.github.com/repos/OWNER/REPO -``` - -**Expected:** Repository JSON data -**If 401:** Token is invalid -**If 404:** Repository not found or no access - -### GitLab Test: - -```bash -curl -H "Authorization: Bearer YOUR_TOKEN" \ - https://gitlab.com/api/v4/projects/OWNER%2FREPO -``` - -**Expected:** Project JSON data -**If 401:** Token is invalid -**If 404:** Project not found or no access - ---- - -## Best Practices - -### โœ… Do This: - -1. **Use HTTPS URLs** - More compatible than SSH in browser -2. **Include .git suffix** - Clearer repo identification -3. **Test credentials first** - Use API test before PR creation -4. **Check token scopes** - Ensure proper permissions -5. **Keep tokens secure** - Don't share or commit them - -### โŒ Avoid This: - -1. **SSH URLs in browser** - May not work consistently -2. **Expired tokens** - Regenerate regularly -3. **Minimal scopes** - Ensure `repo`/`api` access -4. **Wrong platform** - Don't use GitHub token for GitLab -5. **Typos in URLs** - Double-check owner/repo names - ---- - -## Quick Checklist - -Before creating a PR, verify: - -- [ ] Remote URL is correct format -- [ ] Platform detected correctly (check console) -- [ ] Credentials exist in Settings โ†’ Git -- [ ] Token is valid and not expired -- [ ] Token has correct scopes (`repo` for GitHub, `api` for GitLab) -- [ ] Source and target branches exist -- [ ] No existing PR for these branches -- [ ] Branch has been pushed to remote - ---- - -## Still Having Issues? - -1. **Clear browser cache** - Sometimes helps with stale data -2. **Try different browser** - Rule out browser-specific issues -3. **Check GitHub/GitLab status** - Verify services are operational -4. **Regenerate token** - Create fresh token with correct scopes -5. **Test in terminal** - Verify Git operations work outside Shakespeare - ---- - -## Getting Help - -When asking for help, provide: - -1. **Console output** - Copy relevant logs -2. **Remote URL** - Sanitize personal info first -3. **Platform** - GitHub or GitLab -4. **Error message** - Exact error text -5. **Token scopes** - What permissions are granted -6. **Browser** - Chrome, Firefox, Safari, etc. - ---- - -*Last Updated: October 14, 2025* -*Version: 1.0*