Auto-suggest opening a PR upon session completion#213
Merged
dhilgaertner merged 1 commit intomainfrom Apr 25, 2026
Merged
Conversation
Extends the initial session prompt emitted by ClaudeLauncher and the matching crow-workspace skill template with steps 3-6: implement, commit, push, and open a provider-specific PR/MR whose body links back to the ticket via "Closes #<n>". When the ticket URL is itself a pull/merge request, pushes update the existing one instead of opening a new PR. Closes #196 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
dgershman
approved these changes
Apr 24, 2026
Collaborator
dgershman
left a comment
There was a problem hiding this comment.
Code & Security Review
Critical Issues
None found.
Security Review
Strengths:
- No user-controlled input flows into the shell commands embedded in the prompt template — ticket numbers are
Int?(not arbitrary strings), so injection into theCloses #Nsyntax is not possible. - The
isPullRequestURLcheck uses simple substring containment (/pull/,/merge_requests/), which is correct and not bypassable in a meaningful way given the URL is already stored server-side. - Existing security measures (prompt file
0o600permissions,shellEscapefor paths) remain intact and unaffected by this change.
Concerns:
- None.
Code Quality
Well done:
- Clean separation of
appendOpenPRStepas a private helper — keepsgeneratePromptreadable. isPullRequestURLis astaticfunction (no actor isolation needed), appropriate since it's a pure function.- All provider/ticket-number combinations are covered: GitHub with/without ticket number, GitLab with/without, nil provider, and the PR-URL override path.
- Tests are thorough — 10/10 pass. New tests cover both the GitHub PR and GitLab MR "ticket is already a PR" paths, and existing tests were strengthened with assertions for the new steps 3-6.
- SKILL.md stays in sync with the
ClaudeLaunchertemplate, keeping the two sources of truth aligned.
Minor observations (non-blocking):
- The
--base main/--target-branch mainis hardcoded. If a repo uses a different default branch (e.g.,master,develop), the generated command will target the wrong branch. This is a pre-existing design decision and doesn't need to block this PR, but worth noting for a future enhancement.
Summary Table
| Priority | Issue |
|---|---|
| 🟢 Green | Hardcoded main as base branch — consider making configurable in the future |
Recommendation: Approve — clean, well-tested feature addition with no security or correctness concerns. The PR/MR detection logic is sound, test coverage is comprehensive, and the SKILL.md documentation stays synchronized.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ClaudeLauncherso Claude Code wraps up each session by opening a provider-specific PR/MR linked to the ticket viaCloses #<n>./pull/or/merge_requests/, skip the "open a PR" step and tell the agent to push to update the existing PR instead.skills/crow-workspace/SKILL.mdin sync with theClaudeLaunchertemplate (including the "existing PR detected" override).ClaudeLauncherTestsand add two new cases covering GitHub PR URLs and GitLab MR URLs.Closes #196
Test plan
swift test --package-path Packages/CrowClaude— 10/10 passmake build— succeeds/crow-workspace <github-issue-url>session and confirm the generated prompt contains thegh pr create ... --body "Closes #<n>"step/crow-workspace <gitlab-issue-url>and confirm theglab mr create ...step is emitted/crow-workspace <github-pr-url>and confirm the prompt instructs pushing (no new PR)🤖 Generated with Claude Code