Skip to content

PR handling improvements#7

Merged
boneskull merged 5 commits intomainfrom
pr-updates
Jan 29, 2026
Merged

PR handling improvements#7
boneskull merged 5 commits intomainfrom
pr-updates

Conversation

@boneskull
Copy link
Copy Markdown
Owner

  • feat(github): improve stack comments with PR titles and links
  • feat(cmd): refactor pr command and enhance log output

Replace code-block tree with markdown nested lists containing clickable
PR links. Fetch PR titles via GraphQL in a single batched request.

- Add PRInfo struct and GetPRTitles for batch title fetching
- Add RepoURL, PRURL, FindPRByHead client helper methods
- Add GenerateAndPostStackComment convenience method
- Skip comment updates when body unchanged (reduces API noise)
- Render tree as nested markdown lists instead of code blocks
- Bold current PR link, include '(this PR)' marker
- Improve warning message with parent PR link
Refactor 'gh stack pr' to wrap 'gh pr create' interactively:
- Pass through user flags after '--' (e.g., --fill, --web, --title)
- Auto-draft PRs targeting non-trunk branches
- Use FindPRByHead to discover newly created PRs
- Improve error messages with actionable hints
- Extract updateExistingPR helper for clarity

Enhance 'gh stack log' to display PR URLs:
- Show clickable URLs in tree view
- Add URL column to porcelain output
Copilot AI review requested due to automatic review settings January 29, 2026 00:52
@boneskull
Copy link
Copy Markdown
Owner Author

boneskull commented Jan 29, 2026

Stack


Managed by gh-stack

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves PR stack comment generation and refactors the PR creation command to use the GitHub CLI interactively.

Changes:

  • Enhanced stack comments to include PR titles and clickable links using a GraphQL batch request
  • Refactored pr command to wrap gh pr create interactively instead of using direct API calls
  • Added URL output to log command for better navigation

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
internal/github/github.go Added GetPRTitles (GraphQL batch fetch), FindPRByHead, PRURL, and RepoURL methods; added Title field to PR struct
internal/github/github_test.go Added comprehensive tests for FindPRByHead method (success, not found, and error cases)
internal/github/comments.go Updated GenerateStackComment to accept PR info and repo URL; added CollectPRNumbers; refactored renderTree to use markdown lists with links; updated FindStackComment to return body; added skip-if-unchanged optimization; added GenerateAndPostStackComment helper
internal/github/comments_test.go Updated all tests to use new signature; added tests for PR links, branch formatting, markdown lists, fallback behavior, and bolding
cmd/pr.go Refactored to use gh.ExecInteractive instead of direct API calls; added updateExistingPR helper; improved error messages; added usage examples
cmd/log.go Added optional GitHub client to display PR URLs in both tree and porcelain output
cmd/sync.go Updated to use batch PR title fetching and pass prInfo through the tree walk
internal/git/git_test.go Added trailing newline (whitespace-only change)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Fix redundant PR number in link text (was '[PR #1 #1]', now '[#1]')
- Add GraphQL error handling to GetPRTitles
- Add comprehensive tests for GetPRTitles
- Update test to expect correct fallback format
Copilot AI review requested due to automatic review settings January 29, 2026 01:08
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Add TestGetCommits, TestGetCommitsNoCommits, TestGetCommitsSingleCommit
  for full coverage of the new GetCommits method
- Add --fill-verbose to hasBodyFlag check so we don't override user's
  explicit body generation request
- Document GetPRTitles limitation for very large stacks (100+ PRs)
- Document porcelain output format in printPorcelain function comment
@boneskull boneskull merged commit c08e781 into main Jan 29, 2026
5 checks passed
@boneskull boneskull deleted the pr-updates branch January 29, 2026 23:44
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