Skip to content

Conversation

@michael-airspace
Copy link
Collaborator

@michael-airspace michael-airspace commented Oct 6, 2025

Summary

Enhanced the git_push_to_branch tool to support updating PR descriptions when pushing changes to branches with existing pull requests.

Changes

Initial Implementation

  1. Slash Command (.claude/commands/git_push.md)

    • Added gh pr view to context gathering to fetch current PR info
    • Added pr_description parameter documentation
  2. Configuration (src/config.yaml)

    • Added optional pr_description parameter to git_push_to_branch tool definition
  3. Implementation (src/mcp_server.py)

    • Updated execute_git_push_to_branch() to accept optional pr_description parameter
    • After successful push, calls gh pr edit if description provided
    • Updated handler function signature to accept and pass through pr_description

PR Feedback Fixes

  1. Fail-Fast Enforcement (src/mcp_server.py:316)

    • Changed PR update failures to return error (❌) instead of partial success (✅)
    • Maintains fail-fast principle when user explicitly provides pr_description
  2. Robust PR Body Handling (src/mcp_server.py:312-328)

    • Switched from --body to --body-file for PR description updates
    • Uses temporary file to avoid shell escaping issues with multi-line content
    • Includes proper cleanup in finally block
  3. Empty Files List Validation (src/mcp_server.py:287,216,360)

    • Added validation in all 3 git tools to reject empty files lists
    • Provides clear error message for defensive programming
  4. Documentation Fix (.claude/commands/git_push.md:28-29)

    • Moved pr_description to "Optional parameters" section
    • Fixed inconsistency with config.yaml and implementation

Behavior

  • If pr_description is provided and a PR exists for the branch, the PR description is updated via temp file
  • If PR update fails, returns error (fail-fast principle)
  • If no pr_description provided, behaves exactly as before (no change)
  • Empty files lists are rejected with clear error message

Design Philosophy

Simple KISS implementation with proper error handling - no fallbacks or partial success masking. Follows fail-fast principle consistently.

- Add optional pr_description parameter to git_push_to_branch
- Slash command now gathers current PR info via gh pr view
- Tool updates PR description if provided and PR exists
- Updates config, handler, and executor function signatures
Added guidance for creating detailed commit messages when addressing PR feedback.

Changes:
- Added "PR Feedback Response" section to .claude/commands/git_push.md (lines 19-48)
- Instructs to use structured format in commit message body:
  ✅ Addressed items with file:line references
  ⏭️ Deferred items with rationale
  ❌ Not applicable items with clear reasoning
- Includes example commit message format
- Ensures feedback responses are documented in git history, not just PR descriptions

This improves PR review workflows by standardizing how feedback is documented in commits.
@michael-airspace michael-airspace merged commit d823f46 into main Oct 6, 2025
1 check passed
@michael-airspace michael-airspace deleted the feature/add-pr-description-to-git-push branch October 6, 2025 23:16
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