Ragex. Git. PR
(Ragex v0.18.1)
View Source
Pull Request attribution and indexing.
Uses the gh CLI (GitHub) or glab CLI (GitLab) to fetch PR metadata,
including title, author, description, review comments, files changed,
and merge commit. Results are stored in an ETS table and persisted
to disk as Erlang term format (.etf).
Gracefully degrades: if neither gh nor glab is installed, all
functions return {:error, :no_pr_cli}.
Examples
# Index all merged PRs (incremental)
{:ok, stats} = PR.index("/opt/project")
# Find which PR introduced a commit
{:ok, pr} = PR.find_pr_for_commit("/opt/project", "abc123")
# Get review comments for a file
comments = PR.review_comments_for_file("/opt/project", "lib/user.ex")
Summary
Functions
Clear PR index from memory.
Find the PR that introduced a given commit SHA.
Get a specific PR by number.
Index PRs for the repository, fetching from GitHub/GitLab.
Load persisted PR index for a repository.
Get review comments associated with a file path.
Functions
@spec clear() :: :ok
Clear PR index from memory.
@spec find_pr_for_commit(String.t(), String.t()) :: {:ok, Ragex.Git.PR.PRInfo.t()} | {:error, term()}
Find the PR that introduced a given commit SHA.
Searches the PR index for a PR whose merge_commit_sha matches, or whose files overlap with the commit's changed files.
@spec get_pr(pos_integer()) :: {:ok, Ragex.Git.PR.PRInfo.t()} | {:error, :not_found}
Get a specific PR by number.
Index PRs for the repository, fetching from GitHub/GitLab.
Incremental: only fetches PRs newer than the last indexed one.
Options
:force-- re-index all PRs (defaultfalse):limit-- max PRs to fetch (default 100)
@spec load(String.t()) :: :ok | {:error, :not_found}
Load persisted PR index for a repository.
Get review comments associated with a file path.
Returns comments from all PRs that touched the file.