Skip to content

Add comprehensive PR checkout support#30

Closed
jellydn wants to merge 1 commit intotobi:mainfrom
jellydn:add-pr-support
Closed

Add comprehensive PR checkout support#30
jellydn wants to merge 1 commit intotobi:mainfrom
jellydn:add-pr-support

Conversation

@jellydn
Copy link
Copy Markdown
Contributor

@jellydn jellydn commented Sep 7, 2025

Summary

Add full support for checking out GitHub Pull Requests with automatic fork detection and seamless workflow integration.

Key Features

  • Multiple PR formats supported:

    • try https://github.com/owner/repo/pull/123
    • try owner/repo#123
    • try 123 (when in git repository context)
  • Smart fork handling:

    • Detects fork PRs using GitHub API
    • Clones from fork repository with correct branch
    • Falls back to base repo for same-repo PRs
  • Implicit command support:

    • try <pr-url> works without explicit cd command
    • Seamless integration with existing git URI shortcuts
  • Consistent directory naming:

    • Format: YYYY-MM-DD-owner-repo-pr123
    • Custom names supported: try pr-url custom-name

Examples

# Fork PR - clones from fork with correct branch  
try https://github.com/josegonzalez/minui-artwork-scraper-pak/pull/33
# → 2025-09-07-josegonzalez-minui-artwork-scraper-pak-pr33

# Short format
try owner/repo#123
# → 2025-09-07-owner-repo-pr123  

# In git repo context
cd ~/my-repo && try 456 custom-test
# → 2025-09-07-custom-test

Implementation Details

  • GitHub API integration for fork detection
  • Comprehensive error handling with fallbacks
  • Shell script generation with proper git operations
  • 25 new tests covering all scenarios and edge cases

Test plan

  • All existing tests pass (61 total tests)
  • New comprehensive test suite (25 additional tests)
  • Fork PR detection verified with real GitHub PRs
  • Implicit command handling tested
  • Error cases and fallbacks validated
  • Cross-platform shell compatibility verified

🤖 Generated with Claude Code

Features:
- Support PR URLs: https://github.com/owner/repo/pull/123
- Support short format: owner/repo#123
- Support PR numbers in git repos: try 123
- Automatic fork detection and proper repository cloning
- Implicit command handling (try <pr-url> without cd)
- Custom directory naming support

Implementation:
- GitHub API integration for fork PR detection
- Smart repository selection (fork vs base)
- Comprehensive test coverage (25 new tests)
- Shell script generation with proper git operations
- Fallback handling for API failures

Directory naming format: YYYY-MM-DD-owner-repo-pr123

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@tobi
Copy link
Copy Markdown
Owner

tobi commented Sep 26, 2025

I get that this is a bit arbitrary but I feel that's going too far in terms of magic cli complexity and LOC impact for this tool.

@tobi tobi closed this Sep 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants