Skip to content

Add POST /tasks/:taskId/branches/link to link existing branches without GitHub create #16

Description

@Anshulgada

Problem

POST /projects/:projectId/tasks/:taskId/branches always calls GitHub to create the branch before inserting into github_task_branches.

When developers create branches in their IDE or agent and only want to associate an existing branch with a task, the API returns:

GitHub API error: Reference already exists

Pull request linking already supports this pattern via POST .../pull-requests/link. Branches had no equivalent.

Proposed solution

Add a link-only endpoint:

POST /projects/:projectId/tasks/:taskId/branches/link

Body:

{
  "repo_id": "uuid",
  "branch_name": "feature/my-branch"
}

Expected behavior:

  1. Verify repo_id belongs to the project
  2. Verify the branch ref exists on GitHub
  3. Insert into github_task_branches (ON CONFLICT DO NOTHING)
  4. Emit github.branch_linked
  5. Allow one branch → many tasks

Also add MCP tool github_link_branch_to_task, mirroring github_link_pr_to_task.

Status

Implemented in a single clean commit — see open PR from branch feat/link-branch-clean (supersedes earlier draft PR #17).

Use case

Branch and PR are created outside Paca (IDE, agent, GitHub web). Tasks are linked afterward for traceability — same workflow as pull-requests/link.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions