PR Phase 1: Create, List, and View Pull Requests

did:plc:b2mcbcamkwyznc5fkplwlxbf opened this Feb 10, 2026 0 comments
did:plc:b2mcbcamkwyznc5fkplwlxbf opened Feb 10, 2026

Implement the author workflow for creating and viewing pull requests.

Tasks

  • Implement tangled pr create --base <base-branch> --head <head-branch> --title <title> [--body <body> | --body-file <file> | -F -] command.
    • Warn if the branch is behind the target branch, as tangled.org has trouble with diffs when there are unmerged changes. Suggest merging the target into this branch before proceeding and confirm if the user wants to continue. Add a flag to override this behaviour and merge without checking for unmerged commits.
    • Generate the git diff patch between the --head and --base branches.
    • Gzip-compress the patch (the tangled.org web UI uploads blobs with mimeType: "application/gzip").
    • Upload the compressed patch as a blob using com.atproto.repo.uploadBlob with mimeType: "application/gzip".
    • Resolve the target repo AT-URI (e.g. at://did:plc:.../sh.tangled.repo/<rkey>) from the git remote.
    • Create a sh.tangled.repo.pull record using com.atproto.repo.createRecord with fields: target (repo AT-URI + base branch), source (head branch + 40-char SHA), title, optional body, patchBlob (blob ref), and createdAt.
  • Implement tangled pr list [--json <fields>] command to list pull requests for the current repository.
    • Use com.atproto.repo.listRecords with collection: "sh.tangled.repo.pull".
    • Output should include the pull request number, CID, title, source branch, and status.
  • Implement tangled pr view <id> [--json <fields>] command to display detailed information about a specific pull request.
    • Use com.atproto.repo.getRecord for the sh.tangled.repo.pull record.
    • Fetch associated comments using com.atproto.repo.listRecords with collection: "sh.tangled.repo.pull.comment".
    • Dogfood the CLI by using it to create a pull request for these changes, then view the created PR to verify all data is correctly stored and retrieved.

Reference

Example sh.tangled.repo.pull record shape (from live data):

{
  "$type": "sh.tangled.repo.pull",
  "title": "...",
  "source": { "sha": "<40-char SHA>", "branch": "<head-branch>" },
  "target": { "repo": "at://<did>/sh.tangled.repo/<rkey>", "branch": "<base-branch>" },
  "createdAt": "<ISO datetime>",
  "patchBlob": { "$type": "blob", "ref": { "$link": "<CID>" }, "mimeType": "application/gzip", "size": <bytes> }
}

No activity yet.

cospan · schematic version control on atproto built on AT Protocol