Skip to content

feat: support try pr with gh url#121

Draft
jellydn wants to merge 2 commits into
tobi:mainfrom
jellydn:feat/pr-command
Draft

feat: support try pr with gh url#121
jellydn wants to merge 2 commits into
tobi:mainfrom
jellydn:feat/pr-command

Conversation

@jellydn

@jellydn jellydn commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

What

Added support for the try pr command and direct GitHub PR URL shorthand.

Why

Users need a way to easily check out GitHub pull requests into date-prefixed trial environments or local git worktrees without having to manually construct git clone/fetch commands or branch checkouts.

How

  • Intercepted GitHub PR URLs in cmd_cd! to route them as PR URL shorthand.
  • Implemented cmd_pr! command router to handle numeric PR IDs, shorthand repository/ID combinations (user/repo#id), and full GitHub PR URLs.
  • Created shell script generators script_clone_pr (for remote repository checkouts) and script_worktree_pr (for local repository worktrees).
  • Added test coverage in spec/tests/test_38_pr.sh and documented the command in spec/command_line.md.

Checklist

  • Tests added or updated
  • Documentation updated
  • No breaking changes (or breaking changes documented above)

@jellydn

jellydn commented Jun 23, 2026

Copy link
Copy Markdown
Contributor Author

How to Test This PR

You can test these changes locally using the following scenarios:

1. Setup dev symlink (optional but recommended)

To test the integration in your current shell:

ln -sf "$(pwd)/try.rb" ~/.local/bin/try-dev

2. Test explicit try pr command

You can test the command directly using a temporary trial path:

  • With a numeric PR ID (run this from inside a local git repository to test worktree creation):
    TRY_PATH=$(mktemp -d) ./try.rb pr 121
  • With a repo + ID shorthand:
    TRY_PATH=$(mktemp -d) ./try.rb pr tobi/try#121
  • With a full GitHub PR URL:
    TRY_PATH=$(mktemp -d) ./try.rb pr https://github.com/tobi/try/pull/121

3. Test direct PR URL shorthand (no command keyword)

Passing the PR URL directly to try (or try cd) should automatically route it to the PR workflow:

TRY_PATH=$(mktemp -d) ./try.rb cd https://github.com/tobi/try/pull/121

4. Run automated tests

Run the spec test runner:

./spec/tests/runner.sh ./try.rb

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.

1 participant