capability_id: pr.branch.update
version: "1.0.0"
description: Update pull request branch with latest base branch changes.
input_schema:
  type: object
  required: [owner, name, prNumber]
  properties:
    owner: { type: string, minLength: 1 }
    name: { type: string, minLength: 1 }
    prNumber: { type: integer, minimum: 1 }
  additionalProperties: false
output_schema:
  type: object
  required: [prNumber, updated]
  properties:
    prNumber: { type: integer, minimum: 1 }
    updated: { type: boolean }
  additionalProperties: false
routing:
  preferred: graphql
  fallbacks: [cli]
graphql:
  operationName: PrBranchUpdate
  operationType: mutation
  documentPath: src/gql/operations/pr-branch-update.graphql
  # Resolution maps the user-facing inputs to the GraphQL mutation variables:
  # - pullRequestId is the GraphQL node id, looked up from owner/name/prNumber.
  resolution:
    lookup:
      operationName: PrNodeId
      documentPath: src/gql/operations/pr-node-id.graphql
      vars:
        owner: owner
        name: name
        prNumber: prNumber
    inject:
      - target: pullRequestId
        source: scalar
        path: repository.pullRequest.id
cli:
  command: pr update-branch
