Pull request commands
Three commands read pull requests as they are right now, open ones included: safran pulls find gets from a ticket, a branch or a link to the pull request, safran pulls list lists them across the code hosts, and safran pulls show prints one with its reviewers and, on request, its changed files, review threads and diff. None of them changes anything; safran links show is the command for merged history from the local store.
$ safran pulls find PAY-10
pull request state title author tickets updated
→ payments-api#7 open PAY-10 fix partial refund rounding Ayşe Yılmaz PAY-10 27 h ago
1 match for PAY-10. → safran pulls show payments-api#7 --threadsThe examples on this page were captured against Safran's in-memory test connectors loaded with acme's data, so a pull request URL has /fake/ in it; on Azure Repos it looks like https://dev.azure.com/acme/Platform/_git/payments-api/pullrequest/7. Type labels in messages were written as the acme profile's (azure-repos). Times are relative to the moment of the run and shown in UTC.
| Command | Reads | Calls |
|---|---|---|
safran pulls find | live pull requests, and the link store for merged work | the code hosts with live pull requests; the tracker's reference matching is offline |
safran pulls list | live pull requests | the code hosts with live pull requests |
safran pulls show | one pull request | the code hosts with live pull requests |
A pull request reference is whatever you would paste: a pull request URL, <repo>#<id> when the repo name is unique across hosts, or <host id>:<repo>#<id>. Quote a reference with # in shells that treat it as a comment. The commands need a code host that serves live pull requests (azure-repos, github, gitlab); a local host has none. What each host can do, and what was verified against a live service, is on pull requests.
safran pulls find
safran pulls find [url | ticket] [options]Finds the pull request for one thing: a pull request URL, a ticket reference, or with --branch a source branch. A ticket matches pull requests that carry its key: a native link on the host, the title, the source branch or the description, among the live ones and, for merged work, in the link store. The match marked → is the one to read without asking: the only one, or the only open one. Finding nothing is an answer and exits with 0.
| Flag | Value | Default | Meaning |
|---|---|---|---|
--branch <name> | a branch name | Look for pull requests from this source branch instead of a URL or ticket. | |
--repo <name> … | repeatable, comma list | all repos | Only in these repos (ticket and branch lookups). |
--state <state> | open, merged, closed, all | open ones when there are any, else merged and closed | Which states to return. |
--limit <n> | whole number, at least 1 | 10 | Most matches to show. |
The last line names the next command. When nothing matches:
$ safran pulls find PAY-20
No pull request found for PAY-20.
→ Merged work is found through the link store: safran links refresh keeps it current.JSON
matches holds full pull requests, best the one marked → (absent when the choice is not obvious), truncated whether more matched than --limit, and warnings the hosts that could not be asked. The lookup by branch:
{
"matches": [
{
"description": "Rounds to cents instead of whole units.\n\nCloses PAY-10.",
"url": "https://git.acme.example/fake/payments-api/pull/7",
"linked_ticket_keys": [],
"state": "open",
"draft": false,
"reviewers": [
{
"person": {
"name": "Çağrı Öztürk"
},
"vote": "waiting",
"required": true
},
{
"person": {
"name": "Deniz Kaya"
},
"vote": "approved"
}
],
"labels": [
"bug"
],
"id": "7",
"repo": "payments-api",
"title": "PAY-10 fix partial refund rounding",
"author": {
"name": "Ayşe Yılmaz"
},
"source_branch": "feature/PAY-10-rounding",
"target_branch": "main",
"created_at": "2026-03-17T09:00:00Z",
"updated_at": "2026-03-19T09:00:00Z",
"mergeability": "clean",
"counts": {
"changed_files": 3,
"additions": 2,
"deletions": 1,
"commits": 2,
"active_threads": 2
},
"host": "azure",
"ticket_keys": [
"PAY-10"
]
}
],
"best": { "…": "the same object as matches[0]" },
"truncated": false,
"warnings": []
}Exit codes and mistakes
0 when the lookup ran, also with no match; 1 for a Safran error (no host with live pull requests, an unknown repo); 2 for a usage error, such as both a reference and --branch.
- An open pull request that is not found by ticket. The lookup reads the 200 newest pull requests per host. Find an older one by URL or by
--branch. - A merged pull request that is not found. Merged work comes from the link store: run
safran links refresh.
safran pulls list
safran pulls list [options]Lists pull requests across every code host that serves them, newest first, with the ticket keys recognised in each. It takes no argument. A host that fails or cannot apply a filter is reported on stderr and the others are still listed.
| Flag | Value | Default | Meaning |
|---|---|---|---|
--repo <name> … | repeatable, comma list | all repos | Only these repos. |
--group <group> … | repeatable, comma list | all | Only repos in these profile groups. |
--host <id> | a code host id from the profile | every host with live pull requests | Only this code host entry. |
--state <state> | open, merged, closed, all | open | open includes drafts; closed means closed without being merged. |
--author <who> | a name, an e-mail address or an id as the host knows it | Only by this author. An exact match, case ignored for names and addresses. | |
--reviewer <who> | a name, an e-mail address or an id as the host knows it | Only where this person is a reviewer, whatever they voted. | |
--limit <n> | whole number, at least 1 | 20 | Pull requests to show. Values above 100 are clamped to 100. |
--cursor <cursor> | next_cursor of the previous --json page | Continue a listing, with the same filters. |
$ safran pulls list
pull request state title author tickets updated
payments-api#7 open PAY-10 fix partial refund rounding Ayşe Yılmaz PAY-10 27 h ago
web-app#9 open (draft) Spike: new basket layout Ayşe Yılmaz 9 days ago
2 pull requests
$ safran pulls list --state all --repo payments-api
pull request state title author tickets updated
payments-api#7 open PAY-10 fix partial refund rounding Ayşe Yılmaz PAY-10 27 h ago
payments-api#8 merged PAY-12 migrate the refund ledger Çağrı Öztürk PAY-12 2026-02-12
payments-api#10 closed Abandoned experiment Ayşe Yılmaz 2026-01-11
3 pull requestsWhen more exist than were shown, the summary line says so (more exist; raise --limit or narrow the filters). An empty answer names the state that was asked: No closed pull requests found.
JSON
items are full pull requests with host and ticket_keys; next_cursor is null on the last page; warnings lists hosts that were left out.
{
"items": [
{
"description": "",
"url": "https://git.acme.example/fake/payments-api/pull/8",
"linked_ticket_keys": [],
"state": "merged",
"draft": false,
"reviewers": [],
"labels": [],
"id": "8",
"repo": "payments-api",
"title": "PAY-12 migrate the refund ledger",
"author": {
"name": "Çağrı Öztürk"
},
"source_branch": "feature/PAY-12-ledger",
"target_branch": "main",
"created_at": "2026-02-10T09:00:00Z",
"updated_at": "2026-02-12T09:00:00Z",
"merged_at": "2026-02-12T09:00:00Z",
"host": "azure",
"ticket_keys": [
"PAY-12"
]
}
],
"next_cursor": null,
"warnings": []
}Exit codes and mistakes
0 when the list was printed, also when it is empty; 1 for a Safran error; 2 for a usage error.
$ safran pulls list --state opn
✘ --state must be one of open, merged, closed, all; got "opn"
→ Did you mean open?
$ safran pulls list --repo payments-ap
✘ No repo named "payments-ap"
→ Did you mean: payments-api?
$ safran pulls list
✘ No configured code host supports live pull requests
→ Configured code hosts: local (local, no live pull requests).safran pulls show
safran pulls show <ref> [options]Shows one pull request: state and whether it can be merged, author, branches, the tickets recognised in it, reviewers with their votes, labels, dates, size, and the description. The extras are separate calls and fail on their own terms: a part the code host cannot serve is reported on stderr and the rest is still shown.
| Flag | Value | Default | Meaning |
|---|---|---|---|
--changes | none | off | List the changed files. |
--threads | none | off | Show the review threads, grouped by file, unresolved first. |
--diff | none | off | Show the diff, with line numbers. |
--path <file> … | repeatable, comma list | every changed file | With --diff: only these files. |
--unresolved | none | off | With --threads: only active threads. |
$ safran pulls show payments-api#7
payments-api#7 PAY-10 fix partial refund rounding
state open can be merged
author Ayşe Yılmaz
branches feature/PAY-10-rounding → main
tickets PAY-10
reviewers Çağrı Öztürk (waiting, required), Deniz Kaya (approved)
labels bug
created 2026-03-17
updated 2026-03-19
size 3 files, +2 −1, 2 commits, 2 active threads
host azure
url https://git.acme.example/fake/payments-api/pull/7
Rounds to cents instead of whole units.
Closes PAY-10.
More: safran pulls show payments-api#7 --changes --threads --diffWith --changes and --threads (the header is the same and cut here):
$ safran pulls show payments-api#7 --changes --threads
…
Changes (3)
change file lines
edit src/refund/service.ts +2 −1
add docs/flow.png
rename src/refund/policy.ts → src/refund/rules.ts +0 −0
Threads (4: 2 active, 1 outdated, 1 resolved)
src/refund/service.ts 1 active, 1 resolved
● active lines 6–7 · thread t-active
Çağrı Öztürk 2026-03-18 10:00
Yuvarlama için test eksik.
Ayşe Yılmaz 2026-03-18 11:00
Ekliyorum.
✔ resolved (fixed) line 5 · thread t-resolved
Çağrı Öztürk 2026-03-17 10:00
Rename this variable?
General 1 active, not attached to a file
● active thread t-general
Deniz Kaya 2026-03-18 12:00
Please link the ticket in the description.
src/refund/policy.ts 1 outdated
○ outdated line 2 (old side) · thread t-outdated
Çağrı Öztürk 2026-03-17 09:30
This file is going away.A thread is active, resolved (with the host's own word in brackets) or outdated (the code it was written on changed since). --unresolved keeps the active ones, which is the list to work through after a review:
$ safran pulls show payments-api#7 --threads --unresolved
…
Threads (2: 2 active)
src/refund/service.ts 1 active
● active lines 6–7 · thread t-active
Çağrı Öztürk 2026-03-18 10:00
Yuvarlama için test eksik.
Ayşe Yılmaz 2026-03-18 11:00
Ekliyorum.
General 1 active, not attached to a file
● active thread t-general
Deniz Kaya 2026-03-18 12:00
Please link the ticket in the description.--diff prints each file's hunks with the old and the new line number in two columns:
$ safran pulls show payments-api#7 --diff
…
Diff (3 files)
edit src/refund/service.ts +2 −1
@@ -4,4 +4,5 @@ export function refundPartial(
4 4 if (amount <= 0) throw new Error('refund amount must be positive');
5 - const rounded = Math.round(amount);
5 + const cents = Math.round(amount * 100);
6 + const rounded = cents / 100;
6 7 return { orderId, refunded: rounded, chargeback: false };
7 8 }
add docs/flow.png
(binary file, no text diff)
rename src/refund/policy.ts → src/refund/rules.ts +0 −0
(no text changes)A binary file and a pure rename are listed without hunks, so "not shown" can be told from "not changed". Diff text, titles, descriptions and comments are third-party text: escape sequences are removed before they reach the terminal.
JSON
pull_request is always present. changes, threads and diff appear when asked for, each with its …_next_cursor. Keys are snake_case. Two of the four threads are cut from this listing.
{
"pull_request": {
"description": "Rounds to cents instead of whole units.\n\nCloses PAY-10.",
"url": "https://git.acme.example/fake/payments-api/pull/7",
"linked_ticket_keys": [],
"state": "open",
"draft": false,
"reviewers": [
{
"person": {
"name": "Çağrı Öztürk"
},
"vote": "waiting",
"required": true
},
{
"person": {
"name": "Deniz Kaya"
},
"vote": "approved"
}
],
"labels": [
"bug"
],
"id": "7",
"repo": "payments-api",
"title": "PAY-10 fix partial refund rounding",
"author": {
"name": "Ayşe Yılmaz"
},
"source_branch": "feature/PAY-10-rounding",
"target_branch": "main",
"created_at": "2026-03-17T09:00:00Z",
"updated_at": "2026-03-19T09:00:00Z",
"mergeability": "clean",
"counts": {
"changed_files": 3,
"additions": 2,
"deletions": 1,
"commits": 2,
"active_threads": 2
},
"host": "azure",
"ticket_keys": [
"PAY-10"
]
},
"changes": [
{
"path": "src/refund/service.ts",
"change": "edit",
"additions": 2,
"deletions": 1
},
{
"path": "docs/flow.png",
"change": "add"
},
{
"path": "src/refund/rules.ts",
"previous_path": "src/refund/policy.ts",
"change": "rename",
"additions": 0,
"deletions": 0
}
],
"changes_next_cursor": null,
"threads": [
{
"id": "t-active",
"path": "src/refund/service.ts",
"line": {
"start": 6,
"end": 7
},
"side": "new",
"status": "active",
"comments": [
{
"id": "2",
"author": {
"name": "Çağrı Öztürk"
},
"body": "Yuvarlama için test eksik.",
"created_at": "2026-03-18T10:00:00Z",
"system": false
},
{
"id": "3",
"author": {
"name": "Ayşe Yılmaz"
},
"body": "Ekliyorum.",
"created_at": "2026-03-18T11:00:00Z",
"system": false
}
]
}
],
"threads_next_cursor": null
}Exit codes and mistakes
0 when the pull request was shown; 1 for a Safran error; 2 for a usage error (--path without --diff, --unresolved without --threads).
$ safran pulls show payments-api#99
✘ Pull request 99 not found in payments-api
$ safran pulls show nope
✘ "nope" is not a pull request reference
→ Pass a pull request URL, "<host id>:<repo>#<id>" or "<repo>#<id>". Configured code hosts: azure (azure-repos).#swallowed by the shell.payments-api#7is fine in most shells; inside a script or after a space, quote it.- Expecting
pulls showto post a comment. Nosafrancommand writes. Agents do, through the MCP server, when the profile allows it; see write commands. - Reading
closedas merged.closedmeans abandoned. A merged pull request saysmerged.