Skip to main content

Module gh

Module gh 

Source
Expand description

GitHub CLI integration for PR operations.

This module provides functions to interact with the GitHub CLI for checking prerequisites and managing pull requests.

§Modules

  • [types] - Core types for PR operations
  • format - PR title and description formatting
  • [pr] - PR creation and management
  • [detection] - PR detection for branches
  • [context] - PR context gathering for reviews
  • [branch] - Branch context for PR reviews

Structs§

BranchContext
Context about the current branch for PR reviews
PRComment
A single comment on a PR
PRContext
Full context about a PR for review
PullRequestInfo
Information about an open pull request

Enums§

BranchContextResult
Result of gathering branch context
PRContextResult
Result of gathering PR context
PRDetectionResult
Result of attempting to detect a PR for the current branch
PRResult
Result type for PR creation operations
TemplateAgentResult
Result from running the PR template agent.

Functions§

build_gh_command
Builds the gh pr create or gh pr edit command string.
create_pull_request
Create a pull request for the current branch using the GitHub CLI
detect_pr_for_current_branch
Detect the PR for the current branch
detect_pr_template
Detects and returns the content of a PR template if one exists in the repository.
ensure_branch_pushed
Ensure the current branch is pushed to the remote
extract_pr_url
Extracts a PR URL from the agent’s output.
find_spec_for_branch
Find the spec file for a given branch
format_pr_description
Format a Spec into a well-structured GitHub PR description in Markdown format
format_pr_title
Format a Spec into a concise PR title
format_spec_for_template
Formats spec data for inclusion in the PR template prompt.
gather_branch_context
Gather context about the current branch for PR review
gather_pr_context
Gather full context for a PR including unresolved comments
get_existing_pr_number
Get the PR number for an existing pull request for the given branch
get_existing_pr_url
Get the URL of an existing pull request for the given branch
get_pr_info_for_branch
Get PR info for a specific branch
is_gh_authenticated
Check if the user is authenticated with GitHub CLI
is_gh_installed
Check if the GitHub CLI (gh) is installed and available in PATH
list_open_prs
List all open PRs in the repository
pr_exists_for_branch
Check if a pull request already exists for the given branch
print_branch_context
Print a summary of the branch context
run_template_agent
Run a Claude agent to populate a PR template and execute the gh command.
update_pr_description
Update the description of an existing pull request