114 lines
2.6 KiB
Markdown
114 lines
2.6 KiB
Markdown
# gitea-pr-review
|
|
|
|
> English documentation | 中文: [README.md](./README.md)
|
|
|
|
`gitea-pr-review` fetches Gitea Pull Requests and converts them into LLM-friendly documents.
|
|
|
|
## Features
|
|
|
|
- Fetch core PR context: title, status, branches, commit list, and basic diff stat
|
|
- Preserve review/comment/reply content in full
|
|
- Two output formats:
|
|
- `markdown`: ready for direct LLM input
|
|
- `json`: structured output for automation and post-processing
|
|
- Re-render Markdown from existing JSON without calling Gitea again
|
|
|
|
## Build
|
|
|
|
```bash
|
|
cargo build --release
|
|
# binary: target/release/gitea-pr-review
|
|
```
|
|
|
|
## Environment Variables
|
|
|
|
Required for the `fetch` subcommand:
|
|
|
|
- `GITEA_PR_CLI_API_TOKEN`
|
|
- `GITEA_PR_CLI_URL` (for example: `https://gitea.com`)
|
|
- `GITEA_PR_CLI_REPO` (for example: `Origami404/aaa`)
|
|
|
|
## Usage
|
|
|
|
### 1) Fetch from Gitea (`fetch`)
|
|
|
|
```bash
|
|
# default: markdown to stdout
|
|
gitea-pr-review fetch <pr-index>
|
|
|
|
# json to stdout
|
|
gitea-pr-review fetch <pr-index> --format json
|
|
|
|
# write to file
|
|
gitea-pr-review fetch <pr-index> --out pr.md
|
|
gitea-pr-review fetch <pr-index> --format json --out pr.json
|
|
```
|
|
|
|
### 2) Render Markdown from JSON (`render-md`)
|
|
|
|
```bash
|
|
# to stdout
|
|
gitea-pr-review render-md --in pr.json
|
|
|
|
# to file
|
|
gitea-pr-review render-md --in pr.json --out pr.md
|
|
```
|
|
|
|
### 3) Show current document version
|
|
|
|
```bash
|
|
gitea-pr-review version
|
|
# v1
|
|
```
|
|
|
|
## Skill For LLMs
|
|
|
|
This repository includes a reusable skill for other LLMs to operate this CLI correctly:
|
|
|
|
- Path: `skills/gitea-pr-review-cli/SKILL.md`
|
|
- Scope: standardized usage of `fetch` / `render-md` / `version`, `v1` version contract, and troubleshooting
|
|
|
|
## Markdown Output Shape (Example)
|
|
|
|
````md
|
|
# <repo> `#<pr-index>` <pr-title>
|
|
|
|
> Numbering: Review `<pr>.<review>`; Comment `<pr>.<review>.<comment>`; Reply `<pr>.<review>.<comment>.<reply>`
|
|
> version: v1
|
|
> fetched at: <fetch-time-rfc3339>
|
|
|
|
<pr description>
|
|
|
|
## Metadata
|
|
|
|
### Commits
|
|
- <sha-short> <title> (<author>, <date>)
|
|
|
|
### Diff Stat
|
|
total: <files_changed> files, +<additions>, -<deletions>
|
|
- <file-path>: +<additions>, -<deletions>
|
|
|
|
## Review <pr-index>.<review-seq> (<review-state>)
|
|
> <reviewer>
|
|
|
|
### Comment <pr-index>.<review-seq>.<comment-seq>
|
|
<file>:<line>
|
|
<user>:
|
|
```md
|
|
<original comment body>
|
|
```
|
|
|
|
### Reply <pr-index>.<review-seq>.<comment-seq>.<reply-seq>
|
|
<file>:<line>
|
|
<user>:
|
|
```md
|
|
<original reply body>
|
|
```
|
|
````
|
|
|
|
## Notes
|
|
|
|
- Output goes to `stdout` by default; use `--out` to write a file.
|
|
- The renderer preserves markdown-heavy comment bodies safely by adjusting code fences when needed.
|
|
- Both `Comment` and `Reply` include their directly associated file path and line number (when provided by the API).
|